:root {
    --pink-50: #fff5fa;
    --pink-100: #ffe7f2;
    --pink-200: #ffcde1;
    --pink-300: #ffadd0;
    --pink-400: #ff7db6;
    --pink-500: #f45ca0;
    --pink-600: #dc3d8a;
    --pink-700: #ba2b71;
    --pink-800: #8e1f59;

    --text: #3b1e2f;
    --muted: #78566a;
    --white: rgba(255, 255, 255, 0.9);
    --border: rgba(189, 43, 113, 0.18);
    --shadow: 0 18px 45px rgba(186, 43, 113, 0.15);
    --success: #d12424;
}

[hidden] {
    display: none !important;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 30px 16px 60px;
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    text-align: center;
    background:
        radial-gradient(circle at top left,
            rgba(255, 196, 221, 0.9),
            transparent 28%),
        radial-gradient(circle at bottom right,
            rgba(255, 170, 205, 0.8),
            transparent 25%),
        linear-gradient(135deg, #fffafc 0%, #ffeaf5 100%);
}

body>* {
    width: min(100%, 760px);
    margin-right: auto;
    margin-left: auto;
}

nav {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-bottom: 36px;
    padding: 16px 24px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

nav a {
    position: relative;
    color: var(--pink-700);
    font-weight: 700;
    text-decoration: none;
    transition:
        color 0.2s ease,
        transform 0.2s ease;
}

nav a::after {
    position: absolute;
    right: 0;
    bottom: -5px;
    left: 0;
    height: 2px;
    background: var(--pink-500);
    border-radius: 999px;
    content: "";
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

nav a:hover {
    color: var(--pink-600);
    transform: translateY(-1px);
}

nav a:hover::after {
    transform: scaleX(1);
}

h1,
h2,
h3 {
    margin: 0 0 16px;
    color: var(--text);
    text-align: center;
}

h1 {
    font-size: clamp(2.1rem, 5vw, 3.5rem);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

h2 {
    font-size: 1.6rem;
}

p {
    margin: 0 auto 18px;
    color: var(--muted);
    line-height: 1.7;
    text-align: center;
}

#status {
    min-height: 32px;
    margin: 28px auto;
    color: var(--pink-700);
    font-weight: 700;
    text-align: center;
}

#status h1,
#status h2 {
    margin-bottom: 10px;
}

#status a {
    color: var(--pink-700);
    font-weight: 700;
    text-decoration: none;
}

#status a:hover {
    color: var(--pink-800);
}

/* Login */
#login-section {
    width: min(100%, 500px);
    margin: 30px auto;
    padding: 30px 26px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

label {
    color: var(--text);
    font-weight: 700;
}

input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    font: inherit;
    color: var(--text);
    background: #fffafd;
    border: 1px solid var(--pink-200);
    border-radius: 12px;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

input[type="password"]:focus {
    border-color: var(--pink-500);
    box-shadow: 0 0 0 4px rgba(244, 92, 157, 0.14);
}

input[type="checkbox"] {
    accent-color: var(--pink-700);
}

/* Buttons */
button {
    display: block;
    margin: 10px auto 0;
    padding: 14px 22px;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    background: linear-gradient(135deg,
            var(--pink-500),
            var(--pink-700));
    border: none;
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(223, 63, 135, 0.26);
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(223, 63, 135, 0.34);
}

button:active {
    transform: translateY(0);
}

#login-form button,
#guestbook-form button {
    width: 100%;
}

#login-form button {
    margin-top: 10px;
}

#logout-button {
    margin-top: 28px;
    background: linear-gradient(135deg, #ff6d8f, #d63a72);
}

#login-message {
    min-height: 24px;
    margin: 16px auto 0;
    color: var(--success);
    font-weight: 700;
    text-align: center;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(244, 92, 157, 0.28);
    outline-offset: 3px;
}

/* Guestbook box */
body>#guestbook-section {
    width: 360px;
    max-width: calc(100vw - 32px);
    min-width: 0;
    margin-right: auto;
    margin-left: auto;
    padding: 20px 16px;
    overflow: hidden;
    align-self: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

#guestbook-form {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin: 18px auto 20px;
    text-align: left;
}

#guestbook-form input,
#guestbook-form textarea {
    width: 100%;
    padding: 11px 13px;
    font: inherit;
    color: var(--text);
    background: #fffafd;
    border: 1px solid var(--pink-200);
    border-radius: 12px;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

#guestbook-form input:focus,
#guestbook-form textarea:focus {
    border-color: var(--pink-500);
    box-shadow: 0 0 0 4px rgba(244, 92, 157, 0.14);
}

#guestbook-form textarea {
    min-height: 80px;
    max-height: 110px;
    line-height: 1.5;
    resize: vertical;
}

#guestbook-form button {
    margin-top: 5px;
}

/* Scrollable posts box */
#guestbook-list {
    display: flex;
    flex-direction: column;
    gap: 10px;

    width: 100%;
    max-height: 180px;
    margin: 0 auto;
    padding: 9px;

    overflow-y: auto;
    list-style: none;
    text-align: left;

    background: rgba(255, 245, 250, 0.65);
    border: 1px solid var(--pink-200);
    border-radius: 14px;

    scroll-behavior: smooth;
    scrollbar-color: var(--pink-400) var(--pink-100);
    scrollbar-width: thin;
}

#guestbook-list:empty::before {
    display: block;
    padding: 80px;
    color: var(--muted);
    font-style: italic;
    line-height: 1.5;
    text-align: center;
    background: rgba(255, 231, 242, 0.65);
    border: 1px dashed var(--pink-300);
    border-radius: 12px;
    content: "No messages yet. Be the first to leave one!";
}

#guestbook-list li {
    flex-shrink: 90px;
    padding: 19px 13px;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.4;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.95),
            rgba(255, 231, 242, 0.7));
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(186, 43, 113, 0.08);
}

/* Scrollbar for Chrome, Edge, and Safari */
#guestbook-list::-webkit-scrollbar {
    width: 98px;
}

#guestbook-list::-webkit-scrollbar-track {
    background: var(--pink-100);
    border-radius: 999px;
}

#guestbook-list::-webkit-scrollbar-thumb {
    background: var(--pink-400);
    border-radius: 999px;
}

#guestbook-list::-webkit-scrollbar-thumb:hover {
    background: var(--pink-600);
}

#projects-section {
    width: min(100%, 900px);
    margin: 0 auto;
}

.projects-intro {
    margin-bottom: 32px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 28px;
}

.project-card {
    display: flex;
    flex-direction: column;
    min-height: 260px;
    padding: 24px;
    text-align: left;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 22px 42px rgba(186, 43, 113, 0.2);
}

.project-card h2 {
    margin-bottom: 12px;
    color: var(--pink-700);
    font-size: 1.35rem;
    text-align: left;
}

.project-card p {
    margin: 0 0 24px;
    text-align: left;
}

.project-link {
    display: inline-block;
    width: fit-content;
    margin-top: auto;
    padding: 10px 16px;
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    background: linear-gradient(135deg, var(--pink-500), var(--pink-700));
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(223, 63, 135, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-link:hover {
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(223, 63, 135, 0.3);
}

/* Space Picture of the Day */

#space-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: center;
    gap: 12px;
    width: min(100%, 500px);
    margin: 30px auto 22px;
    padding: 24px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

#space-form label {
    display: flex;
    flex-direction: column;
    flex: 1 1 180px;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
    text-align: left;
}

#date {
    width: 100%;
    padding: 13px 14px;
    color: var(--text);
    font: inherit;
    background: #fffafd;
    border: 1px solid var(--pink-200);
    border-radius: 12px;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

#date:focus {
    border-color: var(--pink-500);
    box-shadow: 0 0 0 4px rgba(244, 92, 157, 0.14);
}

#space-form button {
    margin-top: 0;
    padding: 13px 20px;
}

#status {
    min-height: 28px;
    margin: 22px auto;
    color: var(--pink-700);
    font-weight: 700;
    text-align: center;
}

#result {
    width: min(100%, 700px);
    margin: 28px auto 0;
    padding: 28px 24px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

#result h2 {
    margin-bottom: 8px;
    color: var(--pink-700);
}

#date-shown {
    margin-bottom: 22px;
    color: var(--pink-600);
    font-weight: 700;
}

#picture {
    display: block;
    width: 100%;
    max-height: 520px;
    margin: 0 auto 22px;
    object-fit: cover;
    background: var(--pink-100);
    border: 1px solid var(--pink-200);
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(186, 43, 113, 0.16);
}

#description {
    max-width: 620px;
    margin-bottom: 24px;
    text-align: left;
}

#nasa-link {
    display: inline-block;
    padding: 11px 17px;
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    background: linear-gradient(135deg,
            var(--pink-500),
            var(--pink-700));
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(223, 63, 135, 0.22);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

#nasa-link:hover {
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(223, 63, 135, 0.3);
}

@media (max-width: 600px) {
    #space-form {
        align-items: stretch;
        flex-direction: column;
        padding: 22px 18px;
    }

    #space-form label {
        flex-basis: auto;
    }

    #space-form button {
        width: 100%;
    }

    #result {
        padding: 22px 16px;
    }

    #picture {
        max-height: 360px;
    }

    #description {
        text-align: center;
    }

    #nasa-link {
        width: 100%;
    }
}

@media (max-width: 750px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .project-card {
        min-height: auto;
    }
}

/* Mobile layout */
@media (max-width: 600px) {
    body {
        padding: 22px 14px 40px;
    }

    nav {
        gap: 10px 18px;
        padding: 14px 16px;
    }

    nav a {
        font-size: 0.92rem;
    }

    #login-section {
        width: 100%;
        padding: 22px 18px;
    }

    body>#guestbook-section {
        width: min(360px, calc(100vw - 28px));
        padding: 18px 14px;
    }

    #guestbook-list {
        max-height: 170px;
    }

    #logout-button {
        width: 100%;
    }
}