body {
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
    url("pixelart_for_maze.png");
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
    color: white;
    font-family: JetBrains Mono;
}

h1 {
    margin-bottom: 20px;
    color: #333;
}
#controls {
    margin-bottom: 20px;
    text-align: center;
}

#canvas-container {
    border: 3px solid #333;
    background: white;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    overflow: auto;
    max-width: 95vw;
    max-height: 80vh;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

canvas {
    display: block;
    background: white;
}

#error {
    color: #d9534f;
    min-height: 20px;
    margin: 10px 0;
    font-weight: bold;
}

input[type="file"] {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 4px;
}

h1 {
    color: #F5E8C7;
    font-size: 60pt;
}
#container_1 {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 80%;
    background-color: #D1B48BA8;
    border-radius: 5px;
    font-size: 15pt;
}
#container_generator {
    display: flex;
    flex-direction: column;
    padding: 15px;
    width: 45%;
}
#container_algorithm {
    width: 45%;
    padding: 15px;
}
#algorithm_form {
    width: 100%;
}
.speed-control {
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #D1B48BA8;
    width: 80%;
    height: 50px;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    font-size: 15pt;
}
button {
  background: linear-gradient(to bottom right, #a0435f, #f4d7ae);
  border: 0;
  border-radius: 12px;
  color: #FFFFFF;
  cursor: pointer;
  display: inline-block;
  font-family: -apple-system,system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 2.5;
  outline: transparent;
  margin-top: 10px;
  padding-left: 10px;
  padding-right: 10px;
  text-align: center;
  text-decoration: none;
  transition: box-shadow .2s ease-in-out;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  white-space: nowrap;
}

button:not([disabled]):focus {
  box-shadow: 0 0 .25rem rgba(0, 0, 0, 0.5), -.125rem -.125rem 1rem rgba(239, 71, 101, 0.5), .125rem .125rem 1rem rgba(255, 154, 90, 0.5);
}

button:not([disabled]):hover {
  box-shadow: 0 0 .25rem rgba(0, 0, 0, 0.5), -.125rem -.125rem 1rem rgba(239, 71, 101, 0.5), .125rem .125rem 1rem rgba(255, 154, 90, 0.5);
}

#choose_algorithm {
    
}
#speed-slider {
    flex-grow: 1;
    max-width: 300px;
}

#speed-value {
    min-width: 60px;
    text-align: right;
}

#random {
    color: #2196F3;
}

#semirandom {
    color: #83BC14;
}

#lefthand {
    color: #AD625C;
}

#righthand {
    color: #7C4385E6;
}

#dfslabel {
    color: #009688;
}

#ranking-btn {
    margin: 10px;
}

#ranking-container {
    display: flex;
    justify-content: flex-start;
    border: 3px solid #333;
    background: white;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    overflow: auto;
    max-width: 95vw;
    max-height: 80vh;
    align-items: center;
}

#ranking-sqr {
    background-color: white;
    display: block;
    margin: 10px;
}
@media screen and (max-width: 768px) {
    h1 {
        font-size: 36pt;
        text-align: center;
    }
    
    #container_1 {
        flex-direction: column;
        width: 95%;
        font-size: 12pt;
    }
    
    #container_generator, #container_algorithm {
        width: 90%;
        padding: 10px;
    }
    
    .speed-control {
        width: 95%;
        font-size: 12pt;
        height: auto;
        padding: 10px 0;
    }
    
    #canvas-container, #ranking-container {
        max-width: 100vw;
        max-height: 60vh;
    }
    
    button {
        padding: 8px 12px;
        font-size: 14px;
        line-height: 1.5;
    }
    
    input[type="number"], select {
        width: 100%;
        box-sizing: border-box;
    }
    
    #algorithm_form input[type="checkbox"] {
        margin: 5px 0;
    }
    
    #algorithm_form label {
        display: inline-block;
        margin: 5px 0;
    }
}

@media screen and (max-width: 480px) {
    h1 {
        font-size: 28pt;
    }
    
    body {
        padding: 10px;
    }
    
    #maze-size {
        width: 80px;
    }
}
