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

:root {
    --sky-color-1: #020010;
    --sky-color-2: #0b0926;
    --sky-color-3: #1a1545;
}

body {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--sky-color-1) 0%, var(--sky-color-2) 50%, var(--sky-color-3) 100%);
    background-attachment: fixed;
    overflow: hidden;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    position: relative;
    margin: 0;
}

#scroll-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 1;
    cursor: grab;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

#scroll-wrapper::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.is-dragging, .is-dragging * {
    cursor: grabbing !important;
    user-select: none !important;
}

#scroll-content {
    width: 3000px;
    height: 3000px;
    position: relative;
}

#zoom-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 3000px;
    height: 3000px;
    transform-origin: 0 0;
    transition: transform 0.2s ease-out;
}

#constellationCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none; 
}

#sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

#ui-layer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 20px;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

#ui-layer-top {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
    pointer-events: none;
}

.search-container {
    width: 100%;
    max-width: 300px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    pointer-events: auto;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.toggle-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 8px 15px;
    pointer-events: auto;
}

.toggle-container label {
    color: white;
    font-size: 0.8rem;
    margin-left: 5px;
    cursor: pointer;
}

.zoom-controls {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2px 10px;
    pointer-events: auto;
    gap: 10px;
    color: white;
}

.zoom-controls button {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.zoom-controls button:hover {
    opacity: 0.7;
}

.zoom-controls button svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.zoom-controls button:hover svg {
    transform: scale(1.1) rotate(15deg);
}

#zoomLevelIndicator {
    font-size: 0.8rem;
    min-width: 40px;
    text-align: center;
}

#searchInput {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 0.85rem;
    outline: none;
}

#searchInput::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.input-container {
    width: 100%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
    position: relative;
}

.expiry-note {
    position: absolute;
    top: -22px;
    right: 20px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    pointer-events: none;
    letter-spacing: 0.05em;
}

#memoInput {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 0.95rem;
    resize: none;
    outline: none;
    padding: 5px;
    max-height: 150px;
    overflow-y: auto;
}

#memoInput::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.checkbox-container label {
    color: rgba(255,255,255,0.4);
    font-size: 0.7rem;
    cursor: pointer;
}

#addMemoBtn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 15px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#addMemoBtn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-left: 10px;
    min-width: fit-content;
}

.footer-links a {
    color: rgba(255,255,255,0.4);
    font-size: 0.7rem;
    text-decoration: none;
}

.sub-links {
    display: flex;
    gap: 5px;
    font-size: 0.6rem;
    color: rgba(255,255,255,0.2);
}

.sub-links a {
    color: inherit;
    text-decoration: none;
}

.star-node {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 0 15px 4px rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.star-node.private {
    background-color: #ffd700;
    box-shadow: 0 0 15px 4px rgba(255, 215, 0, 0.7);
}

.star-node.public {
    background-color: #87ceeb;
    box-shadow: 0 0 15px 4px rgba(135, 206, 235, 0.7);
}

.star-node.private:hover,
.star-node.private.active {
    box-shadow: 0 0 25px 8px rgba(255, 215, 0, 1);
}

.star-node.public:hover,
.star-node.public.active {
    box-shadow: 0 0 25px 8px rgba(135, 206, 235, 1);
}

.star-node:hover,
.star-node.active {
    transform: translate(-50%, -50%) scale(1.5);
}

.author-name {
    font-size: 0.7rem;
    color: rgba(135, 206, 235, 0.8);
    margin-bottom: 5px;
    font-weight: bold;
}

.post-bubble {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    width: 220px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    line-height: 1.5;
    pointer-events: none; 
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    z-index: 10;
    white-space: pre-wrap;
    word-break: break-word;
}

.post-preview {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%) scale(1);
    width: auto;
    max-width: 150px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
    z-index: 5;
}

.star-node:hover .post-preview {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
}

.star-node.active .post-preview {
    opacity: 0;
    transform: translateX(-50%) scale(0.8);
}

.star-node.active .post-bubble {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.bg-star {
    position: absolute;
    background-color: #fff;
    border-radius: 50%;
    opacity: 0.3;
    pointer-events: none;
}

.loginOverlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 15, 35, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 40px 30px;
    color: white;
    z-index: 1000;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    gap: 25px;
    text-align: center;
    margin: 0;
    max-height: 90vh;
    overflow-y: auto;
}

.loginOverlay h2 {
    margin-bottom: 10px;
    font-weight: 300;
    letter-spacing: 2px;
    font-size: 1.8rem;
}

.loginOverlay form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: left;
}

.loginOverlay input {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 12px;
    color: white;
    outline: none;
    margin-top: 8px;
    font-size: 1rem;
}

.loginOverlay button {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    border-radius: 12px;
    padding: 15px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
    font-size: 1rem;
}

.loginOverlay button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    #ui-layer-top {
        flex-direction: column;
        align-items: center;
        padding: 50px 10px 10px 10px;
        gap: 8px;
    }

    .search-container {
        max-width: 100%;
    }

    .toggle-container {
        width: fit-content;
        padding: 5px 12px;
    }

    #ui-layer {
        padding: 10px;
    }

    .input-container {
        flex-wrap: wrap;
        justify-content: center;
        padding: 15px 10px 10px 10px;
    }

    #memoInput {
        width: 100%;
        flex: none;
        order: 1;
        margin-bottom: 5px;
    }

    .checkbox-container {
        order: 2;
    }

    #addMemoBtn {
        order: 3;
        flex: 1;
    }

    .footer-links {
        order: 4;
        width: 100%;
        flex-direction: row;
        justify-content: center;
        margin-left: 0;
        margin-top: 5px;
        border-top: 1px solid rgba(255,255,255,0.1);
        padding-top: 8px;
    }

    .sub-links {
        margin-left: 15px;
        align-items: center;
    }

    .expiry-note {
        top: -18px;
        font-size: 0.6rem;
    }

    .post-bubble {
        width: 280px;
        max-width: 90vw;
        font-size: 0.8rem;
        padding: 12px;
        bottom: 30px;
    }

    .star-node {
        width: 14px;
        height: 14px;
    }
}

/* GUI Toggle Button Styles */
.toggle-gui-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 101;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.toggle-gui-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.05);
}

.toggle-gui-btn svg {
    width: 20px;
    height: 20px;
}

.toggle-gui-btn .eye-off-icon {
    display: none;
}

/* GUI非表示時のスタイル */
body.gui-hidden .toggle-gui-btn .eye-icon {
    display: none;
}

body.gui-hidden .toggle-gui-btn .eye-off-icon {
    display: block;
}

body.gui-hidden .toggle-gui-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
}

body.gui-hidden .toggle-gui-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
}

/* GUI要素のトランジション */
.gui-element {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    visibility: visible;
}

body.gui-hidden .gui-element {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

body.gui-hidden #ui-layer.gui-element {
    transform: translateY(20px);
}

body.gui-hidden #ui-layer-top.gui-element {
    transform: translateY(-20px);
}

/* モバイル対応 */
@media (max-width: 768px) {
    .toggle-gui-btn {
        top: 15px;
        right: 15px;
        width: 38px;
        height: 38px;
    }
    .toggle-gui-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* Clouds Layer */
#clouds {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.08); /* Extremely thin semi-transparent white */
    filter: blur(40px);
    border-radius: 50% 50% 40% 40% / 60% 60% 40% 40%; /* Slightly organic cloud shape */
    pointer-events: none;
    animation: moveCloud linear forwards;
}

@keyframes moveCloud {
    from {
        left: -800px;
    }
    to {
        left: 3800px;
    }
}