body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a1a; /* Dark black */
    color: #f0f0f0; /* Light grey text */
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    align-items: center;
}

header {
    background-color: #0d0d0d; /* Even darker black */
    padding: 20px;
    width: 100%;
    text-align: center;
    border-bottom: 3px solid #ff69b4; /* Pink border */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

header .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box; /* Include padding in width calculation */
}

header h1 {
    color: #ff69b4; /* Hot pink */
    margin: 0;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

main {
    flex-grow: 1;
    width: 90%;
    max-width: 900px;
    padding: 20px 0;
}

section {
    background-color: #2a2a2a; /* Slightly lighter black for sections */
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    border: 1px solid #3d3d3d; /* Subtle border */
}

h2 {
    color: #ff69b4; /* Hot pink */
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #f0f0f0;
    font-weight: bold;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"] {
    width: calc(100% - 20px);
    padding: 12px;
    border: 1px solid #ff69b4; /* Pink border */
    border-radius: 5px;
    background-color: #3d3d3d; /* Dark grey for inputs */
    color: #f0f0f0;
    font-size: 1em;
    box-sizing: border-box;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #e0329c; /* Darker pink on focus */
    box-shadow: 0 0 8px rgba(255, 105, 180, 0.5);
}

button {
    background-color: #ff69b4; /* Hot pink */
    color: #1a1a1a; /* Dark text on button */
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

button:hover {
    background-color: #e0329c; /* Darker pink on hover */
    color: #f0f0f0; /* Lighter text on hover */
    transform: translateY(-2px);
}

#login-signup-btn,
#back-to-challenges-btn {
    width: auto; /* Override default 100% width for these specific buttons */
    display: inline-block; /* Allow them to sit next to h1 */
    padding: 8px 15px; /* Smaller padding for header buttons */
    font-size: 0.9em;
    margin-left: 20px; /* Spacing from title */
    vertical-align: middle; /* Align vertically with text */
}

#challenge-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.challenge-item {
    background-color: #1a1a1a; /* Even darker black for items */
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 1px solid #ff69b4; /* Pink border for items */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Pushes delete button to bottom */
}

.challenge-item h3 {
    color: #ff69b4; /* Hot pink */
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.4em;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
}

.challenge-item .level-id {
    font-size: 0.8em;
    color: #ccc;
    background-color: #3d3d3d;
    padding: 3px 8px;
    border-radius: 4px;
}

.challenge-item p {
    margin-bottom: 8px;
    line-height: 1.5;
}

.challenge-item a {
    color: #7affd4; /* A light teal for links, contrasts nicely with pink */
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s ease;
}

.challenge-item a:hover {
    color: #a0ffe7; /* Lighter teal on hover */
    text-decoration: underline;
}

.challenge-item .delete-btn {
    background-color: #dc3545; /* Red for delete */
    color: white;
    margin-top: 15px;
    padding: 8px 15px;
    font-size: 0.9em;
    width: auto;
    align-self: flex-end; /* Align to the right */
    border-radius: 4px;
}

.challenge-item .delete-btn:hover {
    background-color: #c82333; /* Darker red on hover */
    transform: translateY(-1px);
}

footer {
    width: 100%;
    padding: 15px;
    text-align: center;
    background-color: #0d0d0d;
    color: #999;
    font-size: 0.9em;
    margin-top: 30px;
    border-top: 1px solid #3d3d3d;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    main {
        width: 95%;
        padding: 15px 0;
    }

    section {
        padding: 20px;
    }

    button {
        padding: 10px 20px;
        font-size: 1em;
    }

    #login-signup-btn,
    #back-to-challenges-btn {
        padding: 6px 12px;
        font-size: 0.85em;
        margin-left: 15px;
    }

    .challenge-item {
        padding: 15px;
    }

    .challenge-item h3 {
        font-size: 1.2em;
    }

    .challenge-item .delete-btn {
        padding: 6px 12px;
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8em;
    }

    header .header-content {
        flex-direction: column;
        align-items: center;
    }

    #login-signup-btn,
    #back-to-challenges-btn {
        margin-top: 10px;
        margin-left: 0;
        width: auto; /* Ensure it stays auto */
    }

    section {
        padding: 15px;
    }

    input[type="text"],
    input[type="url"],
    input[type="email"],
    input[type="password"] {
        padding: 10px;
    }

    button {
        padding: 10px 15px;
        font-size: 0.95em;
    }
}