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

#renderCanvas {
    width: 100%;
    height: 100%;
    touch-action: none;
    outline: none;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

#blocker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fcfbf4;
    background-image: url('../assets/textures/paper.webp');
    background-size: auto;
    background-repeat: repeat;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    text-align: center;
    transition: opacity 0.8s ease-in-out;
}

#blocker .content-wrapper {
    max-width: 800px;
    padding: 2rem;
    position: relative;
    z-index: 101;
}

#blocker h1 {
    font-size: clamp(3.5rem, 10vw, 7rem);
    margin: 0;
    font-weight: normal;
    line-height: 0.9;
    letter-spacing: -0.02em;
    text-transform: none;
}

#blocker h1 span {
    display: block;
}

#blocker h1 .italic {
    font-style: italic;
}

#blocker p {
    font-size: 1.1rem;
    color: #555;
    margin: 2.5rem 0 3.5rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

#startBtn {
    padding: 1.2rem 3.5rem;
    font-size: 0.9rem;
    border: 1px solid #2c2c2c;
    background: transparent;
    color: #2c2c2c;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    text-transform: uppercase;
    letter-spacing: 0.25rem;
    font-weight: 500;
}

#startBtn:hover {
    background: #2c2c2c;
    color: #fcfbf4;
    transform: translateY(-2px);
}

#instructions {
    position: absolute;
    bottom: 40px;
    width: 100%;
    text-align: center;
    color: #555;
    pointer-events: none;
    font-size: 0.9rem;
    display: block;
    opacity: 0.6;
    z-index: 10;
}

#joystickBase {
    position: absolute;
    bottom: 50px;
    left: 50px;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: none;
    z-index: 1005;
    touch-action: none;
}

#joystickKnob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

#mobileInteract {
    position: absolute;
    bottom: 50px;
    right: 50px;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: none;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: bold;
    z-index: 1005;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

@media (pointer: coarse) {
    #instructions {
        display: none !important;
    }
}

#reticle {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 3px;
    height: 3px;
    background-color: white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    display: none;
    border: none;
    transition: background-color 0.1s ease;
}

#editorOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1050;
    display: none;
}

#editorPanel {
    position: fixed;
    top: 120px;
    right: 20px;
    width: 250px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 6px;
    display: none;
    z-index: 1100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    user-select: auto;
    -webkit-user-select: auto;
}

#editorPanel.mobile-layout {
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
}

#editorPanel h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    text-align: center;
}

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

.control-group label {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

input[type=range] {
    width: 100%;
    cursor: pointer;
}

#resetColors {
    width: 100%;
    padding: 8px;
    border: 1px solid #333;
    background: #fff;
    color: #333;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
}

#resetColors:hover {
    background: #333;
    color: #fff;
}

#infoDialogue {
    position: fixed;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 30px;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 2000;
    text-align: center;
    border: 1px solid #ddd;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

#infoDialogue p {
    margin: 0;
    font-size: 1.1rem;
    color: #1a1a1a;
    line-height: 1.4;
    font-style: normal;
}

#infoDialogue .timer-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #2c2c2c;
    width: 100%;
    transform-origin: left;
}

#infoDialogue.active .timer-bar {
    animation: timer 3s linear forwards;
}

@keyframes timer {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

#infoButton {
    position: fixed;
    top: calc(8vh + 30px);
    left: 30px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    color: #2c2c2c;
    font-size: 1.2rem;
    font-family: serif;
    font-style: italic;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.3s ease;
    user-select: none;
}

#infoButton:hover {
    background: white;
    transform: scale(1.1);
}

.custom-modal {
    display: none;
    position: fixed;
    z-index: 20000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.custom-modal .modal-content {
    background-color: #fcfbf4;
    margin: auto;
    padding: 2rem;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    text-align: center;
    animation: modalFadeIn 0.3s;
}

.custom-modal h2 {
    margin-top: 0;
    font-weight: normal;
    font-size: 2.5rem;
    font-style: italic;
    font-family: 'Mazius Display', serif;
}

.custom-modal h3 {
    font-style: normal;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
    font-family: 'Mazius Display', serif;
}

.custom-modal p {
    font-size: 1rem;
    color: #444;
    line-height: 1.6;
    font-style: normal;
    font-family: 'Mazius Display', serif;
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 20px;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
