@import url('bulma.min.css');
@import url('https://fonts.googleapis.com/css2?family=Germania+One&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap');

:root {
    --color-bg-page: oklch(0.1710 0.0158 26.01);
    --color-bg-half: oklch(0.3852 0.0432 40.48);
    --color-bg-panel: oklch(0.3024 0.0296 32.19);
    --color-text-primary: oklch(0.6152 0.0783 50.77);
    --color-text-emphasis: oklch(0.8856 0.0615 66.09);

    --white: oklch(0.96 0.0265 65.68);

    --red: oklch(0.6333 0.2018 30.45);
    --green: oklch(0.6333 0.2018 142.45);
    --blue: oklch(0.6406 0.1728 258.29);
    --gold: oklch(0.8498 0.173865 86.5517);

    --cell-size: 70px;
}

html {
    background-color: var(--color-bg-page);
}

.content {
    max-width: 500px;
    margin: auto;
}

.box {
    background-color: var(--color-bg-panel);
}

.codex-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;

    .piece-box {
        position: relative;
        background-color: var(--color-bg-half);
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 5px;
        width: 50px;
        height: 50px;
        cursor: pointer;

        img {
            width: 60%;
        }

        &.is-active {
            cursor: default;
            background-color: var(--color-text-primary);
        }
    }
}

.codex-content {
    background-color: var(--color-bg-half);
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border-radius: 5px;
}

/* Global styles */
p,
.button,
.table th,
.table td {
    font-family: "JetBrains Mono", monospace;
    font-optical-sizing: auto;
    font-style: normal;
    color: var(--color-text-primary);
    width: 100%;

    img {
        height: 1.5rem;
        margin-bottom: -.4rem;
    }

    .is-blue{
        color: var(--blue);
    }

    .is-red {
        color: var(--red);
    }

    .is-gold {
        color: var(--gold);
    }
}

.content h1,
.content h2,
.content h3,
.content h4,
.title {
    font-family: "Germania One", system-ui;
    font-weight: 400;
    font-style: normal;
    color: var(--color-text-emphasis);

    .is-blue {
        color: var(--blue);
    }

    .is-red {
        color: var(--red);
    }

    .is-gold {
        color: var(--gold);
    }
}

strong {
    color: var(--color-text-emphasis);
    display: inline-flex;
    align-items: center;
}

.head {
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

.notification {
    position: relative;
    z-index: 1;
    background-color: var(--color-bg-half);
    margin-bottom: 0px !important;
    padding: 10px;
    font-size: 12px;

    p {
        font-weight: 200;
        margin-right: 15px;
        color: var(--color-text-emphasis);
    }

    .delete {
        top: 5px;
        right: 5px;
    }
}

.options {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column-reverse;
    margin-right: .5rem;

    gap: 5px;

    .lang {
        font-size: 1em;
    }

    .button {
        width: 35px;
    }
}

.is-fullwidth {
    width: 100%;
}


.button {
    border: 0px;
    font-family: "Germania One", system-ui;
    font-weight: 400;
    font-style: normal;
    border-radius: 2.5px;

    &.is-blue {
        background-color: var(--blue);
        color: var(--color-bg-page);

        &:hover {
            background-color: oklch(from var(--blue) calc(l + .1) c h);
        }

    }

    &.is-gold {
        background-color: var(--gold);
        color: var(--color-bg-page);

        &:hover {
            background-color: oklch(from var(--gold) calc(l + .1) c h);
        }

    }

    &.is-red {
        background-color: var(--red);
        color: var(--color-bg-page);

        &:hover {
            background-color: oklch(from var(--red) calc(l + .1) c h);
        }

    }

    &.is-kofi {
        background-color: var(--color-bg-panel);
        color: var(--color-text-emphasis);
        width: 200px;

        img {
            height: 16px;
            margin-right: 6px;
        }

        &:hover {
            background-color: oklch(from var(--color-bg-panel) calc(l + .1) c h);
        }
    }

}

.username {
    cursor: pointer;
    display: flex;
    align-items: center;

    gap: 10px;
}

.input,
.select select,
.textarea {
    background-color: oklch(from var(--color-bg-panel) calc(l - .05) c h);
    border: 1px solid var(--color-bg-page);
    color: var(--color-text-emphasis);

    font-family: "JetBrains Mono", monospace;
    font-optical-sizing: auto;
    font-style: normal;
}

.input::placeholder {
    color: oklch(from var(--color-text-primary) calc(l - .1) c h);
}

.label,
.checkbox {
    color: var(--color-text-primary);
    font-family: "JetBrains Mono", monospace;
    font-weight: normal;
}

.select:not(.is-multiple):not(.is-loading)::after {
    border-color: var(--color-text-emphasis);
}

input[type="checkbox"] {
    accent-color: var(--blue);
    width: 1.2em;
    height: 1.2em;
    vertical-align: middle;
    margin-right: 0.5em;
    cursor: pointer;
    background-color: oklch(from var(--color-bg-panel) calc(l - .05) c h);
    border: 1px solid var(--color-bg-page);
}

hr {
    margin: .75rem 0rem;
    background-color: oklch(from var(--color-bg-panel) calc(l - .05) c h);
}

/* Cell styles */
.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;

    img {
        height: 65%;
    }

}

.board {
    position: relative;
    z-index: 0;
    margin: 20px;
    border: 5px solid var(--color-bg-panel);
    border-radius: 2.5px;
    /* Ensure board has size */
    display: inline-block;
}

.board::after {
    content: "";
    position: absolute;
    top: -200px;
    left: -100px;
    width: 200px;
    height: 200px;
    background-image: url('../assets/Flag.svg');
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
    z-index: -99;
}

.grid-layer {
    display: grid;
    grid-template-columns: repeat(7, var(--cell-size));
    gap: 0px;

    .row {
        display: contents;
    }

    .cell {
        .cell-code {
            position: absolute;
            bottom: calc(var(--cell-size) * 0.07);
            right: calc(var(--cell-size) * 0.11);
            font-size: calc(var(--cell-size) * 0.12);
            font-family: monospace;
            line-height: 1;
        }

        &:nth-child(odd) {
            background-color: var(--color-text-emphasis);
            color: var(--color-bg-panel);
        }

        &:nth-child(even) {
            background-color: var(--color-text-primary);
            color: var(--color-bg-panel);
        }

    }

    >div:nth-child(even) {
        .cell:nth-child(odd) {
            background-color: var(--color-text-primary);
        }

        .cell:nth-child(even) {
            background-color: var(--color-text-emphasis);
        }
    }

    .losing-cell {
        background-color: var(--red) !important;

        .cell-code {
            color: oklch(from var(--red) calc(l + .5) c h);
        }
    }

    /* Special cell states */
    .valid-move {
        cursor: pointer;
        box-shadow: inset 0 0 0 5px var(--blue);
        transition: all 0.15s ease-in-out;

        &:hover {
            box-shadow: inset 0 0 0 40px var(--blue);

            .cell-code {
                color: oklch(from var(--blue) calc(l - .5) c h);
            }
        }
    }
}

.board {
    position: relative;
    /* Ensure board is positioned for absolute children */
}

.pieces-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to grid cells */
}

.piece {
    position: absolute;
    width: var(--cell-size);
    height: var(--cell-size);
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Custom easing for a satisfying "snap" or "anticipation" feel */
    transition: transform 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
    z-index: 10;
    will-change: transform;

    img {
        height: 65%;
        /* Match previous size */
    }
}

.piece.trail {
    background-color: var(--red);
    color: oklch(from var(--red) calc(l - .25) c h);
    z-index: 5;
    font-size: 2rem;
    transition: none;
}

.no-animations .piece {
    transition: none !important;
}

.table {
    background-color: transparent;

    th{
        width: 25px !important;
    }

    th,
    td {
        border-bottom: 1px solid var(--color-bg-page);
        width: auto;
    }
}

.is-top-1 {
    color: var(--gold) !important;
    font-weight: bold;
}

.is-top-2 {
    color: var(--color-text-emphasis) !important;
    font-weight: bold;
}

.is-top-3 {
    color: var(--red) !important;
    font-weight: bold;
}

/* Chat log */
.chat-log {
    margin-top: 20px;
    height: 200px;
    width: 100%;
    overflow-y: auto;
    border: 1px solid var(--color-bg-panel);
    border-radius: 5px;
    padding: 10px;

    font-family: "JetBrains Mono", "Segoe UI Symbol", "Noto Sans", system-ui, sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
    color: var(--color-text-primary);
}

.chat-message {
    font-size: .8rem;
    margin-bottom: 4px;

    &.move {
        color: var(--white);
        font-weight: bold;
    }

    &.capture {
        font-weight: bold;
    }

    &.gameover {
        color: var(--red);
        font-weight: bold;
    }

    &.golden {
        color: var(--gold);
    }

    &.red {
        color: var(--red);
    }

    &.blue {
        color: var(--blue);
    }
}

.foot {
    font-size: .75em;
    opacity: .75;
    text-align: center;

    a {
        color: var(--blue);
    }
}

.piece-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

/* Animation for score floating */
.score-float {
    position: absolute;
    height: 30px !important;
    animation: floatUp 1s ease-out forwards;
    pointer-events: none;
    z-index: 10;
    object-fit: contain;
    object-position: center;
    transform: translate(-50%, 0);
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50px);
    }
}

.toast-container {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 30;
    max-width: calc(100% - 40px);
}

.toast {
    background-color: var(--color-bg-panel);
    border: 1px solid var(--color-bg-page);
    color: var(--color-text-emphasis);
    padding: 14px 18px;
    border-radius: 4px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 16px;
}

.toast-message {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.85rem;
}

.toast .delete {
    margin-left: auto;
}

.toast-fade-enter-active,
.toast-fade-leave-active {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-fade-enter-from,
.toast-fade-leave-to {
    opacity: 0;
    transform: translate(-50%, 10px);
}

.modal-content {
    overflow: visible !important;
}

.red-flag, .blue-flag {
    position: relative;
}

.red-flag::before {
    content: "";
    position: absolute;
    top: -125px;
    left: -100px;
    width: 200px;
    height: 200px;
    background-image: url('../assets/red-flag.svg');
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
    z-index: 0;
    transform: scaleX(-1);
}

.red-flag::after {
    content: "";
    position: absolute;
    top: -125px;
    right: -100px;
    width: 200px;
    height: 200px;
    background-image: url('../assets/red-flag.svg');
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
    z-index: 0;
}

.blue-flag::before {
    content: "";
    position: absolute;
    top: -125px;
    left: -100px;
    width: 200px;
    height: 200px;
    background-image: url('../assets/blue-flag.svg');
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
    z-index: 0;
    transform: scaleX(-1);
}

.blue-flag::after {
    content: "";
    position: absolute;
    top: -125px;
    right: -100px;
    width: 200px;
    height: 200px;
    background-image: url('../assets/blue-flag.svg');
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
    z-index: 0;
}

@media screen and (max-width: 768px) {
    .modal-content {
        width: calc(100% - 40px);
        margin: 0 auto;
    }
}

@media screen and (max-width: 600px) {
    :root {
        --cell-size: calc((100vw - 60px) / 7);
    }

    .board {
        margin: 20px auto;
    }

    .banner {
        height: 70px;
        padding: 0 60px;
    }

    .banner p.title {
        font-size: 1.5rem !important;
        line-height: 1.1;
        white-space: nowrap;
    }
}

.lastKiller {
    height: 80px;
    margin-top: -50px;
}

.banner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 115px; /* Largeur des images latérales (~116px) - overlap */
    height: 100px;
    margin-bottom: 25px;
    
    background-repeat: no-repeat, no-repeat, repeat-x;
    background-position: left center, right center, center center;
    background-size: auto 100%;
    background-clip: border-box, border-box, content-box;
    background-image:
            url('../assets/banner-left.svg'),
            url('../assets/banner-right.svg'),
            url('../assets/banner-center.svg');

    &.is-red {
        background-image:
            url('../assets/red-banner-left.svg'),
            url('../assets/red-banner-right.svg'),
            url('../assets/red-banner-center.svg');
        p{
            color: var(--white);
        }
    }

    &.is-gold {
        background-image:
            url('../assets/gold-banner-left.svg'),
            url('../assets/gold-banner-right.svg'),
            url('../assets/gold-banner-center.svg');
        p{
            color: var(--color-bg-page);
        }
    }

    p {
        margin-bottom: 0 !important;
        padding: 0 20px;
        color: var(--color-bg-page);
    }
}
.notification-dot {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 12px;
    height: 12px;
    background-color: var(--red);
    border-radius: 50%;
    border: 2px solid var(--color-bg-page);
}

.notification-dot-tab {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 12px;
    height: 12px;
    background-color: var(--red);
    border-radius: 50%;
    border: 2px solid var(--color-bg-panel);
}

/* Leaderboard tabs */
.leaderboard-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;

    .tab-box {
        position: relative;
        background-color: var(--color-bg-half);
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 5px;
        padding: 10px 20px;
        cursor: pointer;
        font-family: "Germania One", system-ui;
        color: var(--color-text-emphasis);
        transition: all 0.2s ease;

        &.is-active {
            cursor: default;
            background-color: var(--color-text-primary);
            color: var(--color-bg-page);
        }

        &:hover:not(.is-active) {
            background-color: oklch(from var(--color-bg-half) calc(l + .05) c h);
        }
    }
}
/* Loader */
.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.custom-loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--color-text-primary);
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
