body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: Arial, sans-serif;
    background-color: #121212;
    color: #e0e0e0;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

* {
    touch-action: pan-y !important;
}

/* Navbar sombre */
.navbar {
    background-color: #1f1f1f;
    color: #ffffff;
    padding: 0.5rem;
    text-align: top;
    font-size: 1.2rem;
    border-bottom: 2px solid #333;
    display: flex;
    justify-content: space-between;
}

/* Conteneur principal */
.main {
    display: flex;
    height: calc(100vh - 60px);
}

.checkbox-wrapper {
    margin-bottom: 10px;
}

input[type="checkbox"] {
    /* Double-sized Checkboxes */
    -ms-transform: scale(1.5); /* IE */
    -moz-transform: scale(1.5); /* FF */
    -webkit-transform: scale(1.5); /* Safari and Chrome */
    -o-transform: scale(1.5); /* Opera */
    transform: scale(1.5);
    padding: 10px;
}

.checkboxtext {
    margin-left: 5px;
    display: inline;
}

/* Colonne gauche */
.sidebar {
    width: 27%;
    border-right: 2px solid #333;
    padding: 0.75rem;
    padding-bottom: 0;
    box-sizing: border-box;
    background-color: #1a1a1a;
    display: flex;
    flex-direction: column;
}

/* Input sombre */
.filter-input {
    width: 100%;
    padding: 0.5rem;
    box-sizing: border-box;
    background-color: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
}

/* Grille de cases */
.obl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    align-content: top;
    gap: 0.5rem;

    max-height: calc(
        100vh - 200px
    ); /* Ajuste cette valeur selon l’espace que tu veux */
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
}

.obl-grid::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

/* Base style for label */
.case {
    border: 3px solid #666; /* gray by default */
    font-weight: bold;
    min-width: 140px;
    height: 45px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #262626;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.hidden {
    display: none !important;
}

.case:hover {
    background-color: #333;
}

/* When checkbox is checked, style the parent label */
.case.checked {
    border-color: #a5f2f8;
    background-color: #32374a;
}

.case.checked:hover {
    border-color: #a5f2f8;
    background-color: #3f4764;
}

/* Colonne droite */
.content {
    flex: 1;
    padding: 1rem;
    background-color: #181818;
    color: #e0e0e0;
    overflow-y: auto;
}

.filter-input:focus,
.case:focus {
    outline: none;
    box-shadow: 0 0 0 2px #a5f2f8;
}

.selection-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: .5rem 0;
}

button {
    background-color: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0.5rem;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

button:hover {
    background-color: #3a3a3a;
    border-color: #a5f2f8;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #333;
}

.bar-btn {
    background-color: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.bar-btn:hover {
    background-color: #3a3a3a;
    border-color: #a5f2f8;
}

.bar-scramble {
    text-align: center;
    flex: 1;
    font-size: 1.6rem;
    font-weight: bold;
    color: #e0e0e0;
    cursor: text;
    user-select: text;
}

.bottom-bar .bar-scramble {
    font-size: 1.3rem;
}

.timer-box {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.timer-display {
    font-size: 3.5rem;
    font-weight: bold;
    text-align: center;
    margin: 0;
}

.bottom-info {
    text-align: center;
    font-size: 1rem;
    margin-top: auto;
    color: #aaa;
}

.content {
    flex: 1;
    padding: 1rem;
    background-color: #181818;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.bottom-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
    border-top: 2px solid #333;
    padding-top: 25px;
}

#timer {
    font-size: 8em;
    color: white;
}

#timer.red {
    color: #ff4d4d;
}

#timer.green {
    color: #4dff4d;
}

.popup {
    background-color: #00000000;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: -1;

    display: flex;
    align-items: center;
    justify-content: center;
}

.popup.open {
    background-color: rgb(0, 0, 0, 0.9);
    z-index: 999;
}

.popup-inner {
    background-color: #2d2a2a;
    width: 50%;
    height: 80%;
    opacity: 1;
    display: flex;
    flex-flow: column;
}

/* scramble popup */
.scram-bar,
.list-bar {
    flex: 0 1 auto;
    padding: 20px;
    display: flex;
    font-size: 25px;
    justify-content: space-between;
    transition: all 0.2s ease-in-out;
}

.cross {
    padding: 5px;
    transition: all 0.2s ease-in-out;
}

.cross:hover {
    background-color: rgb(255, 255, 255, 0.13);
}

.oblname {
    flex: 0 1 auto;
    font-size: 40px;
    width: 100%;
    text-align: center;
}

.scram-canvas {
    background-color: #00000000;
    left: 0;
    top: 0;
}

#canvas-wrapper {
    width: 100%;
    flex: 1 1 auto;
}

.display-scram {
    user-select: text;
}

.list-menu {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: scroll;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
    border-top: #555 solid;
    border-bottom: #555 solid;
}

.list-item {
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    padding: 10px 20px;
    font-size: 1.5rem;
}

.list-item:hover {
    background-color: rgb(255, 255, 255, 0.13);
}

.list-item.highlighted {
    border: 3px solid #a5f2f8 !important;
}

.list-item.selected {
    text-decoration: underline;
}

.list-btn {
    font-size: 18px;
    border-width: 2px;
    margin: 5px;
    width: 100px;
}

.list-btn.right {
    margin-left: auto;
}

.list-item:nth-child(even) {
    background-color: #2d2a2a;
    border: 3px solid #2d2a2a;
}

.list-item:nth-child(odd) {
    background-color: #343131;
    border: 3px solid #343131;
}

.sublist-name {
    background-color: #222222;
    padding: 10px 20px;
    font-weight: bold;
    text-align: center;
}

.list-buttons {
    background-color: #222222;
    padding: 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
}

@media screen and (max-width: 800px) {
    .popup-inner {
        width: 100%;
        height: 100%;
    }
}

@media screen and (max-width: 900px) {
    .sidebar {
        width: 35%;
    }

    .hidden-mobile {
        visibility: hidden;
        width: 0;
        margin: 0;
        padding: 0;
    }

    .full-width-mobile {
        width: 100%;
        border: 0;
    }

    .selection-grid {
        grid-template-columns: repeat(4, 1fr);
        
    }
}

@media screen and (max-width: 600px) {
    .selection-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 290px) {
    .selection-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}
