/* --- General Styles & Modern Dark Theme --- */
:root {
    --primary-bg-color: #0d1117; /* GitHub Dark Dimmed BG */
    --secondary-bg-color: #161b22; /* GitHub Dark Dimmed secondary BG */
    --primary-text-color: #c9d1d9; /* GitHub Dark Dimmed text */
    --accent-color: #58a6ff; /* GitHub Dark Dimmed blue */
    --highlight-color: #f0f6fc; /* GitHub Dark Dimmed lighter text */
    --button-bg-color: #238636; /* GitHub green */
    --button-hover-bg-color: #2ea043; /* GitHub green hover */
    --button-text-color: #ffffff;
    --border-color: #30363d;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

body {
    background-color: var(--primary-bg-color);
    background-image: radial-gradient(circle at 10% 20%, rgba(88, 166, 255, 0.1), rgba(13, 17, 23, 0.1) 30%),
                      radial-gradient(circle at 90% 80%, rgba(35, 134, 54, 0.1), rgba(13, 17, 23, 0.1) 40%);
    color: var(--primary-text-color);
    font-family: var(--font-family);
    margin: 0;
    padding: 20px;
    text-align: center;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Main Container --- */
.container {
    display: flex;
    flex-direction: column;
    max-width: 800px;
    width: 100%;
    margin: 20px auto;
    padding: 40px;
    background-color: var(--secondary-bg-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

/* --- Header & Main Content --- */
header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

#header-logo { width: 40px; height: 40px; }
header h1 { color: var(--highlight-color); font-size: 2.5em; margin: 0; font-weight: 600; flex-grow: 1; text-align: left; padding-left: 15px;}

#header-controls {
    margin-left: auto; /* Pushes auth button to the right */
}

#btn-mute-music {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--primary-text-color);
    padding: 0 15px;
}

#auth-status-container { text-align: right; }
#btn-auth-action {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--accent-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}
#btn-auth-action:hover {
    background-color: var(--accent-color);
    color: var(--secondary-bg-color);
    border-color: var(--accent-color);
}

main { padding: 20px 0; }

/* --- Intro Animation Styles --- */
#intro-sequence {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    min-height: 180px; /* Pre-allocate space */
}

.intro-step {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.intro-step.visible {
    opacity: 1;
    transform: translateY(0);
}

#intro-sequence img {
    max-width: 150px;
    height: auto;
    border-radius: 8px;
    background-color: rgba(0,0,0,0.2);
    padding: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#main-content {
    /* Main content starts hidden and becomes visible */
}

#welcome h2 { font-size: 2em; margin-bottom: 8px; color: var(--highlight-color); }
#welcome .description { font-size: 1.1em; line-height: 1.6; max-width: 600px; margin: 0 auto 15px auto; }
#motivational-quote {
    font-size: 1.2em;
    font-style: italic;
    color: var(--accent-color);
    margin: 20px auto;
    min-height: 50px; /* Prevent layout shift */
    transition: opacity 0.5s ease-in-out;
}
.quote-fade-out { opacity: 0; }
.credits { font-size: 0.9em; margin-top: 30px; color: #8b949e; }

/* --- Action Buttons --- */
#actions {
    margin-top: 25px;
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

#actions button {
    background-color: #21262d;
    color: var(--highlight-color);
    border: 1px solid var(--border-color);
    padding: 14px 20px;
    font-size: 1em;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}
#actions button:hover {
    background-color: #484f58;
    border-color: var(--accent-color);
    transform: scale(1.05);
}

/* Style for <a> tags that should look like buttons */
.button-link {
    display: inline-block;
    background-color: #21262d;
    color: var(--highlight-color);
    border: 1px solid var(--border-color);
    padding: 14px 20px;
    font-size: 1em;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease-in-out;
}
.button-link:hover {
    background-color: #484f58;
    border-color: var(--accent-color);
    transform: scale(1.05);
}

#btn-donate {
    background-color: #00457C; /* PayPal Blue */
    border-color: #00457C;
    color: #ffffff;
    font-weight: bold;
}
#btn-donate:hover {
    background-color: #002e54;
    border-color: #002e54;
}

#btn-discord {
    background-color: #5865F2; /* Discord Blurple */
    border-color: #5865F2;
    color: #ffffff;
}
#btn-discord:hover {
    background-color: #4f5bda;
    border-color: #4f5bda;
}

#actions button#btn-start {
    background-color: var(--button-bg-color);
    border-color: var(--button-bg-color);
    color: var(--button-text-color);
    font-weight: bold;
}
#actions button#btn-start:hover {
    background-color: var(--button-hover-bg-color);
    border-color: var(--button-hover-bg-color);
}

/* --- Footer --- */
footer {
    padding-top: 20px;
    font-size: 0.9em;
    color: #8b949e; /* GitHub Dimmed faint text */
}

/* --- Modal Styles --- */
.modal {
    display: none;
}
.modal.is-open {
    display: flex; /* Use Flexbox for centering */
    align-items: center;
    justify-content: center;
    position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.8); animation: fadeIn 0.3s ease;
}
.modal-content {
    background: #161b22;
    padding: 30px; border: 1px solid var(--border-color);
    width: 90%; max-width: 500px; /* Slightly smaller for alerts */
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5); animation: slideIn 0.4s ease;
    position: relative;
    z-index: 1001;
    text-align: center; /* Center text for dialogs */
}
.close-button {
    color: #8b949e; float: right; font-size: 32px; font-weight: bold; cursor: pointer; line-height: 0.8;
}
.close-button:hover, .close-button:focus { color: var(--button-text-color); }

.modal h2 { color: var(--accent-color); margin-top: 0; }
.modal p { color: var(--primary-text-color); line-height: 1.6; }
.modal hr { border-color: var(--border-color); margin: 25px 0; }

/* Form Styles */
.modal form label {
    display: block;
    text-align: left;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--primary-text-color);
}
.modal form input, .modal form textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    background-color: var(--primary-bg-color);
    color: var(--primary-text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.modal form input:focus, .modal form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}
.modal form textarea { resize: vertical; min-height: 120px; }

.modal-btn {
    background-color: var(--accent-color);
    color: var(--button-text-color);
    border: none; padding: 12px 20px; font-size: 1em; font-weight: bold;
    border-radius: 6px; cursor: pointer; transition: background-color 0.3s;
    width: 100%;
}
.modal-btn:hover { background-color: #6ab0ff; }
.modal-btn:disabled { background-color: #30363d; cursor: not-allowed; }

.dialog-buttons {
    margin-top: 25px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.dialog-buttons button {
    padding: 10px 25px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dialog-buttons .btn-primary {
    background-color: var(--accent-color);
    color: var(--button-text-color);
}
.dialog-buttons .btn-primary:hover {
    background-color: #6ab0ff;
}

.dialog-buttons .btn-secondary {
    background-color: #30363d;
    color: var(--primary-text-color);
    border-color: var(--border-color);
}
.dialog-buttons .btn-secondary:hover {
    background-color: #484f58;
}

/* PayPal Button Container */
#donate-button-container {
    margin-top: 15px;
    padding: 20px;
    background-color: rgba(88, 166, 255, 0.05);
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}

/* License Modal Styles */
.license-text {
    max-height: 400px;
    overflow-y: auto;
    background-color: var(--primary-bg-color);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    text-align: left;
    font-size: 0.9em;
}
.license-text h4 { color: var(--accent-color); margin-top: 15px; margin-bottom: 5px; }
.license-highlight {
    background-color: rgba(35, 134, 54, 0.15);
    border-left: 3px solid var(--button-bg-color);
    padding: 10px 15px;
    margin: 15px 0;
    border-radius: 4px;
}
.license-highlight p { margin: 0; }

/* --- Launcher View Styles (largely unchanged) --- */
#launcher-view h2 {
    color: var(--highlight-color); font-size: 2em; margin-bottom: 20px;
    border-bottom: 1px solid var(--accent-color); padding-bottom: 10px;
}
.project-list {
    background-color: var(--primary-bg-color); border: 1px solid var(--border-color);
    border-radius: 8px; min-height: 200px; padding: 15px; margin-bottom: 20px; text-align: left;
}
.no-projects-message { color: #888; text-align: center; padding: 50px 0; font-size: 1.1em; }
.project-item {
    background-color: var(--secondary-bg-color); padding: 15px; border-radius: 6px;
    margin-bottom: 10px; border: 1px solid var(--border-color); cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.project-item:hover { background-color: #21262d; border-color: var(--accent-color); }
.project-item h3 { margin: 0; color: var(--highlight-color); font-size: 1.2em; }
.launcher-actions { margin-bottom: 20px; }
#btn-create-project {
    background-color: var(--button-bg-color); color: var(--button-text-color);
    border: 1px solid var(--button-hover-bg-color); padding: 15px 25px; font-size: 1.1em;
    font-weight: bold; border-radius: 8px; cursor: pointer; transition: all 0.3s ease;
}
#btn-create-project:hover { background-color: var(--button-hover-bg-color); }
.storage-warning {
    margin-top: 20px; padding: 15px; background-color: rgba(189, 147, 0, 0.1);
    border: 1px solid rgba(189, 147, 0, 0.4); border-radius: 5px; font-size: 0.9em;
}
.storage-warning p { margin: 0; }

/* Auth Modal Specific Styles */
.auth-switch {
    font-size: 0.9em;
    margin-top: 15px;
    text-align: center;
}
.auth-switch a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}
.auth-switch a:hover {
    text-decoration: underline;
}
.password-hint {
    font-size: 0.8em;
    color: #8b949e;
    text-align: left;
    margin-top: -10px;
    margin-bottom: 15px;
}


/* Verifying Overlay Styles */
#verifying-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 17, 23, 0.9);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--highlight-color);
    font-size: 1.5em;
}
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-left-color: var(--accent-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* --- License Button Link Style --- */
.license-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}
#btn-license {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent-color);
    font-size: 0.9em;
    cursor: pointer;
    text-decoration: none;
}
#btn-license:hover {
    text-decoration: underline;
}

.know-games-button {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent-color);
    font-size: 0.9em;
    cursor: pointer;
    text-decoration: none;
}

.know-games-button:hover {
    text-decoration: underline;
}


/* --- Keyframe Animations --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }


/* --- Context Menu Styles --- */
.context-menu {
    display: none;
    position: absolute;
    z-index: 1000;
    background-color: #21262d;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    padding: 5px 0;
    min-width: 150px;
}

.context-menu.visible {
    display: block;
}

.context-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.context-menu ul li {
    padding: 8px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--primary-text-color);
}

.context-menu ul li:hover {
    background-color: var(--accent-color);
    color: var(--secondary-bg-color);
}

#ctx-delete {
    color: #f85149; /* GitHub red */
}

#ctx-delete:hover {
    color: #ffffff;
    background-color: #da3633;
}

/* Add a class to highlight the selected project item */
.project-item.selected {
    border-color: var(--accent-color);
    background-color: #21262d;
}

.project-item {
    position: relative; /* Needed for positioning the button */
}

.open-folder-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 5px;
    font-size: 1.2em;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.open-folder-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
