@-webkit-keyframes rotation {
    from {
        -webkit-transform: rotate(0deg);
    }

    to {
        -webkit-transform: rotate(360deg);
    }
}

@-moz-keyframes rotation {
    from {
        -moz-transform: rotate(0deg);
    }

    to {
        -moz-transform: rotate(360deg);
    }
}

@-o-keyframes rotation {
    from {
        -o-transform: rotate(0deg);
    }

    to {
        -o-transform: rotate(360deg);
    }
}

@keyframes rotation {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: black;
    font-family: "Lucida Console", Monaco, monospace;

    color: white;

}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.nsmessage {
  padding-right: 0;
  display: inline-block;
  vertical-align: top;
  font-weight: bold;
  color: white;
}

div.nsmessage {
  text-align: center;
}

canvas.emscripten {
    display: block;
    background-color: black;
    position: absolute;
    opacity: 0;
    filter: blur(0) grayscale(0);
    image-rendering: optimizeSpeed;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -o-crisp-edges;
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    margin: auto;
}
canvas.active {
  opacity: 1;
}

/* 2. Remove the blue/orange outline when the canvas is clicked */
#canvas:focus {
  outline: none;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes blur {
    0% {
        filter: blur(0) grayscale(0);
    }

    100% {
        filter: blur(2px) grayscale(1);
    }
}

.spinner {
    height: 30px;
    width: 30px;
    -webkit-animation: rotation 0.8s linear infinite;
    -moz-animation: rotation 0.8s linear infinite;
    -o-animation: rotation 0.8s linear infinite;
    animation: rotation 0.8s linear infinite;
    border: 5px solid #bdff00;
    border-top: 5px solid #719900;
    border-radius: 100%;
}

#status {
    display: inline-block;
    vertical-align: top;
    font-weight: bold;
    color: white;
}

#progress {
    width: 250px;
    height: 10px;
    -webkit-appearance: none;
    appearance: none;
    padding: 5px;
}

progress[value]::-webkit-progress-bar {
    background-color: #8492a6;
    height: 10px;
    border-radius: 15px;
}

progress[value]::-webkit-progress-value {
    background-image: -webkit-linear-gradient(left, #719900, #bdff00);
    height: 10px;
    border-radius: 15px;
}

.output-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px;
    z-index: 999;
    transition: transform 0.3s ease;
    transform: translateY(100%);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.output-container.visible {
    transform: translateY(0);
}

.output-button {
    margin: 5px;
    padding: 8px 15px;
    width: auto;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: black;
    color: white;
    outline-color: #20c20e;
    outline-style: dashed;
    font-family: "Lucida Console", Monaco, monospace;
}

#output {
    display: none;
    height: 200px;
    background-color: black;
    color: white;
    font-family: "Lucida Console", Monaco, monospace;
    outline: none;
    border: none;
    padding: 0;
    width: 100%;
}

#message-container {
    display: none;
    min-height: 50px;
    background-color: rgba(20, 20, 20, 0.5);
    outline: none;
    border: none;
    padding: 0;
    width: 100%;
    position: absolute;
    top: 0;
}

#messages {
    margin-left: 50px;
    color: white;
    font-family: "Lucida Console", Monaco, monospace;
    outline: none;
    border: none;
    padding: 0;
}

#closeUIButton {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background-color: #000;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    display: none;
    font-size: 35px;
}

.hidden-ui {
    display: none !important;
}

.save-manager-modal {
    display: none;

    position: fixed;

    z-index: 1001;

    left: 0;
    top: 0;
    width: 100%;

    height: 100%;

    overflow: auto;

    background-color: rgba(0, 0, 0, 0.8);

    justify-content: center;
    align-items: center;
}

.save-manager-content {
    background-color: #1a1a1a;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;

    max-width: 800px;

    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.close-button:hover,
.close-button:focus {
    color: white;
    text-decoration: none;
}

.minimize-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 11px;
    right: 46px;
    cursor: pointer;
}

.minimize-button:hover,
.minimize-button:focus {
    color: white;
    text-decoration: none;
}

.save-file-list {
    max-height: 400px;

    overflow-y: auto;
    border: 1px solid #333;
    border-radius: 5px;
    padding: 10px;
    background-color: #0d0d0d;
}

.save-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #222;
}

.save-file-item:last-child {
    border-bottom: none;
}

.save-file-info {
    flex-grow: 1;
}

.save-file-info span {
    display: block;
    margin-bottom: 5px;
}

.save-file-actions button {
    margin-left: 10px;
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: #20c20e;
    color: black;
    font-weight: bold;
}

.save-file-actions button.delete-btn {
    background-color: #FA1E4E;
}

.file-upload-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #333;
}

.file-upload-section input[type="file"] {
    background-color: #0d0d0d;
    border: 1px solid #333;
    padding: 8px;
    border-radius: 5px;
    color: white;
}

.file-upload-section input[type="text"] {
    background-color: #0d0d0d;
    border: 1px solid #333;
    padding: 8px;
    border-radius: 5px;
    color: white;
}

.file-upload-section button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    font-weight: bold;
}

.custom-message-box {
    display: none;

    position: fixed;

    z-index: 1002;

    left: 0;
    top: 0;
    width: 100%;

    height: 100%;

    overflow: auto;

    background-color: rgba(0, 0, 0, 0.6);

    justify-content: center;
    align-items: center;
}

.custom-message-box-content {
    background-color: #1a1a1a;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;

    max-width: 400px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.custom-message-box-content button {
    background-color: #20c20e;
    color: black;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 15px;
    font-weight: bold;
}

#mobile-controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;

    pointer-events: none;
    z-index: 100;
}

#joystick-zone {
    position: absolute;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;

}

#button-zone {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: center;

    align-items: center;

    gap: 20px;

    pointer-events: auto;
}

#mobile-buttons {
  display: none;
}

.action-button {

    width: clamp(45px, 12vw, 80px);
    height: clamp(45px, 12vw, 80px);
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto;

    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.1s ease, transform 0.1s ease;
    opacity: 0.7;

}

.action-button.pressed {
    opacity: 1.0;

    transform: scale(0.95);

}

.nipple {
    opacity: 0.7;
}

.nipple.front {
    background-color: rgba(255, 255, 255, 0.7) !important;
}

.nipple.back {
    background-color: rgba(128, 128, 128, 0.5) !important;
}
