#top-bar {
    display: flex;
    justify-content: center; /* Center the title container */
    align-items: flex-start; /* Align to top */
    width: 100%;
    margin-bottom: 20px;
    position: relative;
    gap: 20px;
}

#title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1; /* Allow it to grow */
    box-sizing: border-box;
}

.splash-text {
    font-family: 'Eaglercraft Seven', sans-serif;
    color: #FAD536;
    font-size: 1.6rem;
    text-shadow: 3px 3px 0px #3f3f3f;
    position: absolute;
    top: 65px;
    right: 0px;
    transform: rotate(15deg);
    pointer-events: none; /* So it doesn't block clicks on elements behind it */
    animation: splash-animation 0.5s infinite alternate;
}

@keyframes splash-animation {
    from {
        transform: rotate(14.5deg) scale(1.0);
    }
    to {
        transform: rotate(15.5deg) scale(1.02);
    }
}

@keyframes shine-animation {
    from {
        text-shadow:
            0 0 8px rgba(255, 94, 94, 0.7),
            0 0 20px rgba(199, 0, 0, 0.5),
            2px 2px 5px rgba(0,0,0,0.5);
    }
    to {
        text-shadow:
            0 0 12px rgba(255, 94, 94, 1),
            0 0 30px rgba(199, 0, 0, 0.8),
            2px 2px 5px rgba(0,0,0,0.5);
    }
}

#top-right-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    position: absolute; /* Position it relative to top-bar */
    top: 0;
    right: 0;
}

#profile-container {
    position: relative;
    z-index: 50;
}

#profile-bar {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    padding: 5px 10px 5px 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#profile-bar:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

#profile-pfp {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
    border: 1px solid rgba(255,255,255,0.3);
}

#profile-username {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    margin-right: 5px;
    color: #eee;
}

#profile-menu-toggle {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s;
    padding: 0 5px;
}

#profile-menu-toggle.open {
    transform: rotate(180deg);
}

#profile-dropdown {
    position: absolute;
    bottom: calc(100% + 5px); /* Changed from top to bottom */
    right: 0;
    left: 0; /* Added for centering */
    margin: 0 auto 5px; /* Centered and added bottom margin */
    background-color: #2c2c2c;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 1px solid #444;
    width: 200px;
    overflow: hidden;
    z-index: 49;
}

#profile-dropdown ul {
    list-style: none;
    margin: 0;
    padding: 5px 0;
}

#profile-dropdown li a,
#profile-dropdown li button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 15px;
    text-align: left;
    background: none;
    border: none;
    color: #ddd;
    font-family: 'Roboto', sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
}

#profile-dropdown li a:hover,
#profile-dropdown li button:hover {
    background-color: #3a3a3a;
    color: #fff;
}

#profile-dropdown li input {
    display: none;
}

#profile-section {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    margin-top: 10px;
}

#profile-section #profile-pfp {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
    image-rendering: pixelated;
}

#profile-section .profile-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

#profile-section #profile-username {
    font-family: 'Eaglercraft Seven', sans-serif;
    font-size: 1.5rem;
    color: #eee;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#profile-section .profile-actions {
    display: flex;
    gap: 10px;
}

#profile-section .profile-action-btn {
    padding: 6px 12px;
    font-size: 0.9rem;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    color: #ddd;
    cursor: pointer;
    transition: background-color 0.2s;
}

#profile-section .profile-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.title-logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0; /* Remove margin-bottom to keep it tight with buttons */
}

#logo {
    height: 60px;
    margin-right: 15px;
}

#main-title {
    font-size: 2.5rem;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.6);
    margin: 0;
}

.hyne {
    background: linear-gradient(to bottom, #00E5EE, #1a75ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.launcher-text {
    background: linear-gradient(to bottom, #FF4136, #8B0000);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.version-number {
    display: inline-block; /* Needed for some effects to apply correctly */
    background: linear-gradient(to bottom, #ff5e5e, #c70000);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-stroke: 1px rgba(0,0,0,0.6); /* Thin black outline for definition */
    text-shadow: 
        0 0 8px rgba(255, 94, 94, 0.8),
        0 0 20px rgba(199, 0, 0, 0.6),
        2px 2px 5px rgba(0,0,0,0.5);
    animation: shine-animation 2s infinite alternate;
}

.header-buttons {
    display: flex;
    gap: 15px;
    margin-top: 15px; /* Add space between title and buttons */
    justify-content: center;
}

.header-btn {
    padding: 8px 16px;
    font-size: 1rem;
    font-family: 'Eaglercraft Seven', sans-serif;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    color: #eee;
    cursor: pointer;
    transition: background-color 0.3s;
}

.header-btn:hover {
    background-color: rgba(0, 0, 0, 0.4);
}

.discord-btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    background-color: #555;
    border: 1px solid #777;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s, box-shadow 0.3s;
    font-family: 'Eaglercraft Seven', sans-serif;
}

.discord-btn:hover {
    background-color: #666;
}

@keyframes spin-fast {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

body.brainrot-active #launcher-container {
    animation: spin-fast var(--spin-duration, 0.5s) linear infinite;
}

body.brainrot-active.spin-stopped #launcher-container {
    animation: none;
}

/* Responsive adjustments for mobile */
@media (max-width: 800px) {
    #top-bar { flex-direction: column; align-items: center; gap: 8px; padding: 12px; }
    .title-logo-wrapper { flex-direction: row; gap: 10px; align-items: center; }
    #logo { height: 44px; margin-right: 8px; }
    #main-title { font-size: 1.4rem; text-align: center; }
    .header-buttons { display: none; } /* hide extra header buttons on small screens */
    #top-right-controls { position: static; right: auto; top: auto; margin-top: 6px; }
    #profile-section { max-width: 100%; padding: 10px; gap: 10px; }
    #profile-section #profile-pfp { width: 48px; height: 48px; }
    #profile-section #profile-username { font-size: 1.1rem; }
    #version-tabs { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 8px 6px; }
    .tab-btn { flex: 0 0 auto; padding: 8px 12px; font-size: 0.9rem; border-radius: 8px; }
    #version-list-container { padding: 8px; width: 100%; box-sizing: border-box; }
    .version-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
    .tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .tool-item { padding: 10px; font-size: 0.9rem; text-align: left; }
    #launcher-container { width: 100%; margin: 0; min-height: 100vh; }
    body { background-size: cover; background-position: center; }
}

/* Make modals full-width and easy to use on mobile */
@media (max-width: 600px) {
    .hidden { /* keep existing hidden rules intact */ }
    .modal-content, #profile-settings-modal-content, #backgrounds-modal-content, #diy-modal-content, #suggestions-modal-content, #chat-modal-content, #ai-mode-modal-content { 
        width: calc(100% - 24px);
        height: auto;
        max-height: calc(100vh - 40px);
        margin: 12px;
        border-radius: 10px;
        overflow: auto;
        box-sizing: border-box;
    }
    #profile-settings-modal-body { display: block; gap: 12px; }
    .profile-settings-left, .profile-settings-right { width: 100%; }
    #pfp-canvas-preview { width: 96px; height: 96px; }
    #game-container iframe { height: 60vh; }
}