* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    user-select: none;
    -webkit-user-select: none;
    width: 1479px;
    overflow-y: hidden;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    margin: auto;
    min-height: 100vh;

    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.25) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.2) 0%, transparent 40%),
        linear-gradient(135deg, rgb(170,172,255) 0%, rgb(130,135,255) 50%, rgb(100,105,230) 100%);

    background-attachment: fixed;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;

    background:
        radial-gradient(circle at 30% 40%, rgba(255,255,255,0.15) 0%, transparent 35%),
        radial-gradient(circle at 70% 60%, rgba(255,255,255,0.12) 0%, transparent 35%);

    animation: bgFloat 18s ease-in-out infinite alternate;

    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;

    background-image:
        linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);

    background-size: 60px 60px;

    pointer-events: none;
    z-index: -1;
}

@keyframes bgFloat {
    from {
        transform: translateY(-20px) scale(1);
    }
    to {
        transform: translateY(20px) scale(1.1);
    }
}

#loadingScreen {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    justify-content: center;
    align-items: center;

    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.25) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.2) 0%, transparent 40%),
        linear-gradient(135deg, rgb(170,172,255) 0%, rgb(130,135,255) 50%, rgb(100,105,230) 100%);

    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loadingScreen.hidden {
    opacity: 0;
    visibility: hidden;
}

#loadingBox {
    width: 420px;
    padding: 30px;

    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 12px;

    backdrop-filter: blur(4px);

    text-align: center;
    color: white;

    box-shadow:
        0 0 12px rgba(170,172,255,0.6),
        0 0 25px rgba(80, 90, 200, 0.35);
}

#loadingBox h1 {
    margin-bottom: 20px;
    font-size: 28px;
    text-shadow: 0 0 6px rgba(255,255,255,0.6);
}

#loadingBarOuter {
    width: 100%;
    height: 24px;
    overflow: hidden;

    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
}

#loadingBarInner {
    width: 0%;
    height: 100%;

    background:
        linear-gradient(
            135deg,
            rgb(170,172,255) 0%,
            rgb(140,145,255) 50%,
            rgb(110,115,230) 100%
        );

    transition: width 0.2s ease;
}

#loadingText {
    margin-top: 12px;
    font-size: 18px;
    text-shadow: 0 0 6px rgba(255,255,255,0.6);
}

#gameWrapper {
    opacity: 0;
    transition: opacity 1s ease;
}

#gameWrapper.visible {
    opacity: 1;
}

#grid {
    background-color: transparent;
    display: grid;
    grid-auto-rows: 40px;
    gap: 1px;
    border: 2px solid;
    border-image: linear-gradient(
        135deg,
        rgb(150, 152, 255),
        rgb(93, 98, 193),
        rgb(58, 61, 148)
    ) 1;
    box-shadow:
        0 0 12px rgba(170,172,255,0.6),
        0 0 25px rgba(80, 90, 200, 0.35);
    margin-top: 20px;
    margin-bottom: 20px;
}

body.play #grid {
    background-color: rgb(216, 216, 216);
    box-shadow: 0 0 35px rgba(44, 51, 135, 0.4);
}

body.play #presetDisplay {
    display: none;
}

#toolbar {
    margin: auto;
    width: 1479px;
}

#toolBlocks {
    display: flex;
    gap: 30px;
    margin-bottom: 16px;
}

#toolBlocks > div {
    display: flex;
    gap: 8px;
}

#speedButtons {
    display: flex;
    gap: 8px;
    margin-left: 30px;
}

#levelInfo {
    display: flex;
    gap: 10px;
    align-items: center;
}

body.play #toolBlocks {
    gap: 0;
}

button {
    position: relative;
    overflow: hidden;
    isolation: isolate;

    background: rgba(255,255,255,0.12);
    color: white;
    font-size: 18px;

    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;

    padding: 10px 16px;
    cursor: pointer;

    transition: transform 0.2s ease, box-shadow 0.2s ease;

    z-index: 2;
}

/* Farbverlauf */
button::before {
    content: "";
    position: absolute;
    inset: 0;

    background: linear-gradient(
        135deg,
        rgb(170,172,255) 0%,
        rgb(140,145,255) 50%,
        rgb(110,115,230) 100%
    );

    opacity: 0;
    transition: opacity 0.25s ease;

    z-index: 0;
}

/* Grid Overlay */
button::after {
    content: "";
    position: absolute;
    inset: 0;

    background-image:
        linear-gradient(rgba(255,255,255,0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.15) 1px, transparent 1px);

    background-size: 14px 14px;

    opacity: 0;
    transition: opacity 0.25s ease;

    z-index: 1;
}

/* Text über alles legen */
button:hover::before {
    opacity: 1;
}

button:hover::after {
    opacity: 1;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(80, 90, 200, 0.35);
    text-shadow: 0 0 6px rgba(255,255,255,0.6);
}

button span {
    position: relative;
    z-index: 3;
}

#toolbar button.active::before {
    opacity: 1;
}

#toolbar button.active::after {
    opacity: 1;
}

#toolbar button.active {
    color: white;
    box-shadow: 0 8px 20px rgba(80, 90, 200, 0.35);
    text-shadow: 0 0 6px rgba(255,255,255,0.6);
}

#levelNameInput {
    position: relative;
    overflow: hidden;

    height: 46px;
    min-width: 180px;

    background-color: rgba(255,255,255,0.12);
    color: white;

    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;

    padding: 10px 14px;
    font-size: 18px;
    text-align: center;

    outline: none;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border 0.2s ease,
        background-color 0.25s ease;
}

/* Placeholder Farbe */
#levelNameInput::placeholder {
    color: rgba(255,255,255,0.65);
}

/* Hover Effekt */
#levelNameInput:hover {
    background-color: rgba(170,172,255,0.75);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(80, 90, 200, 0.35);
    text-shadow: 0 0 6px rgba(255,255,255,0.6);
}

/* Fokus Effekt */
#levelNameInput:focus {
    background-color: rgba(170,172,255,0.9);
    transform: translateY(-2px);
    border: 1px solid rgba(255,255,255,0.6);
    box-shadow: 0 8px 20px rgba(80, 90, 200, 0.35);
    text-shadow: 0 0 6px rgba(255,255,255,0.6);
}

.cell {
    width: 40px;
    height: 40px;
    background-color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body .cell:hover {
    border: 3px dotted rgb(110,115,230);
}

body.play .cell:hover {
    border: none;
}

.cell.wall { background-color: black; }

.cell.start {
    background:
        radial-gradient(
            circle at center,
            #b8ff7a 0%,
            #7dff3a 40%,
            #2fa300 100%
        );

    animation: spawnPulse 1.8s ease-in-out infinite;
}

.cell.goal {
    background:
        radial-gradient(
            circle at center,
            #ff9a9a 0%,
            #ff3a3a 45%,
            #a00000 100%
        );

    animation: goalPulse 1.6s ease-in-out infinite;
}

.cell.start,
.cell.goal {
    box-shadow:
        inset 0 0 6px rgba(255,255,255,0.5),
        inset 0 0 10px rgba(0,0,0,0.3);
}

@keyframes goalPulse {
    0% {
        box-shadow:
            inset 0 0 6px rgba(255,255,255,0.5),
            0 0 6px rgba(255,80,80,0.4);
    }

    50% {
        box-shadow:
            inset 0 0 10px rgba(255,255,255,0.7),
            0 0 14px rgba(255,80,80,0.9);
    }

    100% {
        box-shadow:
            inset 0 0 6px rgba(255,255,255,0.5),
            0 0 6px rgba(255,80,80,0.4);
    }
}

@keyframes spawnPulse {
    0% {
        box-shadow:
            inset 0 0 6px rgba(255,255,255,0.6),
            0 0 4px rgba(120,255,120,0.4);
    }

    50% {
        box-shadow:
            inset 0 0 10px rgba(255,255,255,0.8),
            0 0 14px rgba(120,255,120,0.9);
    }

    100% {
        box-shadow:
            inset 0 0 6px rgba(255,255,255,0.6),
            0 0 4px rgba(120,255,120,0.4);
    }
}

.hidden {
    display: none;
}

.cell.player {
    position: relative;
    background: white;
}

.cell.player::after {
    content: "★";

    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 50px;

    background: linear-gradient(
        135deg,
        #ffffff 0%,
        #a6d8ff 40%,
        #4aa3ff 70%,
        #1e5fff 100%
    );

    -webkit-background-clip: text;
    background-clip: text;

    color: transparent;

    text-shadow:
        0 0 6px rgba(80,150,255,0.8),
        0 0 10px rgba(80,150,255,0.4);

    animation: playerShine 1.5s ease-in-out infinite alternate;
}

@keyframes playerShine {
    from {
        transform: scale(1);
        filter: brightness(1);
    }

    to {
        transform: scale(1.1);
        filter: brightness(1.3);
    }
}

.cell.spike {
    position: relative;
    background: white;
}

.cell.spike::after {
    content: "▲▲";

    position: absolute;
    bottom: -8px;
    left: 44%;
    transform: translateX(-50%);

    font-size: 26px;
    letter-spacing: -6px;

    background: linear-gradient(
        180deg,
        #ffae00 0%,
        #ff5a00 60%,
        #a00000 100%
    );

    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;

    text-shadow:
        0 0 4px rgba(255,120,0,0.7),
        0 0 8px rgba(255,80,0,0.5);

    animation: spikeDanger 1.2s ease-in-out infinite alternate;
}

@keyframes spikeDanger {
    from {
        filter: brightness(1);
        transform: translateX(-50%) scale(1);
    }
    to {
        filter: brightness(1.3);
        transform: translateX(-50%) scale(1.05);
    }
}

.cell.jumppad {
    background:
        linear-gradient(
            to top,
            rgba(0,255,255,0.65) 0%,
            rgba(0,255,255,0.65) 1%,
            rgb(255, 255, 255) 100%,
            transparent 100%
        );

    border-bottom: 6px solid rgb(0, 255, 255);

    box-shadow:
        0 0 6px rgba(0,255,255,0.35);
}

#levelNameDisplay, #deathCounter, #presetDisplay {
    position: relative;
    display: inline-block;

    padding: 10px 18px;
    margin-top: 10px;

    font-size: 22px;
    font-weight: bold;
    letter-spacing: 0.5px;

    color: white;

    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;

    backdrop-filter: blur(4px);

    text-shadow: 0 0 6px rgba(255,255,255,0.6);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.25s ease;
}

#warnung {
    display: none;
}

#footerText {
    position: fixed;
    bottom: 10px;
    right: 10px;

    color: white;
    font-size: 14px;
    opacity: 0.7;
}

@media (max-width: 1475px) {
    #grid, #toolbar, #levelNameDisplay, #deathCounter {
        display: none;
    }

    body {
        max-width: 90vw;
    }

    #warnung {
        display: initial;
        padding: 20px;
        text-align: center;
        overflow-wrap: break-word;
        word-break: break-word;
        white-space: normal;
    }

    #warnung p {
        font-weight: bold;
    }
}