/* General styles */
:root {
    --default: #2f4f4f;
    --primary: #007bff;
    --secondary: #87ceeb;
    --background: #e6f3ff;
    --spacing-unit: 1rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: var(--background);
    color: var(--default);
    font-family: "Lato", sans-serif;
    font-weight: 400;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s ease-in-out;
}

h1,
h2 {
    font-family: "Lato", sans-serif;
    font-weight: 900;
    color: var(--primary);
    margin: 0;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 1.5rem;
}

p {
    margin: 0;
}

/* Layout */
.container {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

main {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    flex-grow: 1;
}

header {
    display: flex;
    justify-content: flex-start; /* ALIGNED LEFT */
    margin-bottom: 1rem;
}

/* Components */
.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-link {
    background-color: #fff;
    color: var(--default);
    font-weight: 900;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
}

.nav-link:hover {
    color: var(--background);
    background-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.social-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.social-link {
    background-color: #fff;
    color: var(--default);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 1rem;
}

.social-link img {
    width: 32px;
    height: 32px;
    transition: filter 0.3s;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

.social-link span {
    font-size: 1rem;
    color: var(--default);
    transition: color 0.3s;
    min-width: 0; /* Allow text container to shrink */
    overflow-wrap: break-word; /* Allow long text to wrap */
}

.social-link:hover {
    color: var(--background);
    background-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.social-link:hover img {
    filter: brightness(0) invert(1);
}

.social-link:hover span {
    color: var(--background);
}

.email-user::after {
    content: "@";
}

.email-domain::after {
    content: ".";
}

.player-footer {
    position: sticky;
    bottom: 1rem;
    left: 0;
    right: 0;
    max-width: fit-content;
    margin: 0 auto;
    background-color: var(--background);
    border: 1px solid var(--default);
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    backdrop-filter: blur(10px);
}

.player-container {
    display: flex;
    align-items: center;
    max-width: fit-content;
}

.player-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--default);
    transition: color 0.3s;
    display: flex;
    align-items: center;
}

.player-button:hover {
    color: var(--primary);
}

.player-text {
    margin: 0 1.5rem;
    color: var(--default);
    font-size: 0.9rem;
    line-height: 1;
}

#pixel-battle-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#infinite-canvas-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

#infinite-canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

#bubble-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.color-picker {
    position: fixed;
    transform: translate(-50%, -50%);
    width: 1px;
    height: 1px;
}

.color-option {
    position: absolute;
    width: 20px;
    height: 20px;
    margin-left: -10px;
    margin-top: -10px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    transition: transform 0.1s ease-out;
}

.color-option:hover {
    transform: scale(1.2);
}

/* Glossary Page */
.glossary-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem; /* Space below controls */
}

.glossary-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Tighter spacing */
}

.fish-card {
    background-color: #fff;
    color: var(--default);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
}

.fish-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.fish-card.is-user-fish {
    border: 1px solid var(--primary);
}

#user-fish-container .fish-card {
    margin-bottom: 0.5rem; /* Spacing between user fish and the main list */
}

.fish-card-info {
    flex-grow: 1;
    text-align: left;
}

.fish-card-info h3 {
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
    color: var(--primary);
}

.fish-card-info time {
    font-size: 0.8rem;
    color: var(--default);
}

.fish-card-image {
    width: 80px;
    height: 40px;
    image-rendering: pixelated;
}

.glossary-controls button {
    background-color: transparent;
    border: 1px solid var(--default);
    color: var(--default);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        background-color 0.2s ease-in-out,
        color 0.2s ease-in-out,
        border-color 0.2s ease-in-out;
}

.glossary-controls button:hover:not(:disabled) {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.glossary-controls button:disabled {
    border-color: #ccc;
    color: #ccc;
    cursor: not-allowed;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    #pixel-battle-section {
        display: none;
    }

    .container {
        padding: 1rem;
        gap: 2rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .social-links {
        grid-template-columns: 1fr;
    }

    .player-footer {
        position: static;
        padding: 1rem;
    }

    header {
        justify-content: center;
    }

    .social-link span {
        font-size: 0.9rem;
    }

    body {
        text-align: center;
    }
}

#loader {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: var(--background);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s;
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid var(--primary);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
}

body.loaded #loader {
    opacity: 0;
    pointer-events: none;
}

.notification-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    opacity: 0;
    transition:
        opacity 0.5s ease-in-out,
        transform 0.5s ease-in-out;
    transform: translateY(100px);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.notification-item {
    background-color: var(--primary);
    color: var(--background);
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    max-width: 300px;
    word-wrap: break-word;
    font-size: 0.9rem;
    line-height: 1.3;
    position: relative;
    overflow: hidden;
}

.notification-item::before {
    content: "";
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 20px;
    height: 20px;
    background-color: var(--primary);
    transform: rotate(45deg);
    z-index: -1;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
}

.notification-container.show {
    opacity: 1;
    transform: translateY(0);
}
