body {
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: #cfd5db;
    color: #333;
}

.bpd-displays.centered-single-bpd {
    justify-content: center;
}
.container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    width: 100%;
    max-width: 1200px; /* Increased max-width for two grids */
}
h1 {
    color: #0056b3;
    text-align: center;
    margin-top: 0;
}
label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}
input[type="text"] {
    width: calc(100% - 22px); /* Adjust for padding and border */
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}
.button-group {
    display: flex;
    gap: 10px; /* Space between buttons */
    margin-top: 15px;
    flex-wrap: wrap; /* Allow buttons to wrap */
}
.button-group button {
    flex-grow: 1; /* Distribute space evenly */
    width: auto; /* Override default button width */
}
button {
  display: inline-block;
  padding: 6px 12px;
  margin: 2px;
  font-size: 13px;
  line-height: 1.3;
  color: #222;
  background-color: #fafafa;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

button:hover {
  background-color: #f0f0f0;
  border-color: #999;
}

 .toggle-container {
     display: flex;
     align-items: center;
     margin-top: 15px;
     justify-content: center;
     gap: 20px; /* Space between toggles */
     flex-wrap: wrap; /* Allow toggles to wrap */
 }
 .toggle-item {
     display: flex;
     align-items: center;
 }
 .toggle-item label {
     margin-right: 10px;
     margin-bottom: 0; /* Remove bottom margin for alignment */
 }
 .switch {
     position: relative;
     display: inline-block;
     width: 40px;
     height: 24px;
 }

 .switch input {
     opacity: 0;
     width: 0;
     height: 0;
 }

 .slider {
     position: absolute;
     cursor: pointer;
     top: 0;
     left: 0;
     right: 0;
     bottom: 0;
     background-color: #ccc;
     -webkit-transition: .4s;
     transition: .4s;
     border-radius: 24px;
 }

 .slider:before {
     position: absolute;
     content: "";
     height: 16px;
     width: 16px;
     left: 4px;
     bottom: 4px;
     background-color: white;
     -webkit-transition: .4s;
     transition: .4s;
     border-radius: 50%;
 }

 input:checked + .slider {
     background-color: #2196F3;
 }

 input:focus + .slider {
     box-shadow: 0 0 1px #2196F3;
 }

 input:checked + .slider:before {
     -webkit-transform: translateX(16px);
     -ms-transform: translateX(16px);
     transform: translateX(16px);
 }

#bpd-display-container {
    display: flex; /* Arrange grids side-by-side */
    gap: 20px; /* Space between grids */
    margin-top: 20px;
    justify-content: center; /* Center the grid containers */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}
.bpd-display {
    /* Remove or comment out the following lines: */
    /* flex: 1; */
    /* min-width: 300px; */

    /* Keep this line: */
    overflow-x: auto; /* Allow horizontal scrolling if grid is too wide */
}
 .bpd-display.hidden {
     display: none; /* Hide the mirror BPD display */
 }
.bpd-display h2 {
    text-align: center;
    color: #0056b3;
}
.bpd-grid {
    display: grid;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden; /* Hide overflow from rounded corners */
    margin: 0 auto; /* Center the grid within its container */
}
.grid-cell {
    width: 40px; /* Fixed size for cells */
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #eee;
    box-sizing: border-box; /* Include border in size */
    position: relative; /* Needed for positioning pipes */
    background-color: #fff;
    cursor: pointer; /* Indicate clickable cells */
    transition: background-color 0.1s ease;
}
.grid-cell:hover {
    background-color: #e9e9e9;
}
.grid-cell.selected {
    background-color: #ffda63; /* Highlight color for the first click */
    border: 2px solid #ffc107;
}


/* Styling for the pipes within the cells */
.pipe {
    position: absolute;
    background-color: #555; /* Color of the pipes */
    box-sizing: border-box;
}

/* Blue pipes for all tiles */
.pipe {
  background-color: #1e6bd6; /* medium blue */
}


/* Tile 0: Blank */
.tile-0 .pipe { display: none; }

/* Light orange for blank (tile-0) cells */
.tile-0 {
  background-color: #ffb74d; /* pale orange */
}


/* Tile 1: Cross (+) */
.tile-1 .pipe.horizontal {
    width: 100%;
    height: 4px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}
.tile-1 .pipe.vertical {
    width: 4px;
    height: 100%;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* Tile 2: R-elbow (╭─) */
.tile-2 .pipe.vertical {
    width: 4px;
    height: 50%;
    top: 50%;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-left-radius: 4px; /* Rounded corner */
}
 .tile-2 .pipe.horizontal {
    width: 50%;
    height: 4px;
    top: 50%;
    left: 50%;
    transform: translateY(-50%);
    border-top-left-radius: 4px; /* Rounded corner */
}


/* Tile 3: J-elbow (╯) */
.tile-3 .pipe.vertical {
    width: 4px;
    height: 50%;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-top-right-radius: 4px; /* Rounded corner */
}
.tile-3 .pipe.horizontal {
    width: 50%;
    height: 4px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    border-bottom-right-radius: 4px; /* Rounded corner */
}


/* Tile 4: Vertical (|) */
.tile-4 .pipe.vertical {
    width: 4px;
    height: 100%;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}
 .tile-4 .pipe.horizontal { display: none; }


/* Tile 5: Horizontal (-) */
 .tile-5 .pipe.vertical { display: none; }
.tile-5 .pipe.horizontal {
    width: 100%;
    height: 4px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}


/* Message box for errors */
.message-box {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    color: #fff;
    font-weight: bold;
    text-align: center;
    display: none; /* Hidden by default */
}
.message-box.error {
    background-color: #dc3545;
}
.message-box.info {
     background-color: #17a2b8;
}
 .message-box.success {
    background-color: #28a745;
}
 .message-box.warning {
    background-color: #ffc107;
    color: #333;
}



