@font-face {
    font-family: waffleFont;
    src: url('../fonts/Nunito-VariableFont_wght.ttf');
}

:root {
    --square-bg-green: #6fb05c;
    --square-bg-yellow: #e9ba3a;
    --square-bg-white: #edeff1;
    --square-color-green: #ffffff;
    --square-color-yellow: #ffffff;
    --square-color-white: #000000;
    --bg-white: white;
    --bg-black: black;
    --color-white: white;
    --color-black: black;
    --overlay-bg: rgba(0,0,0,.3);
    --eee: #eee;
    --888: #888;
    --menu-item-header-bg: var(--eee);
    --menu-item-even-bg: rgb(245, 245, 245);
    --menu-item-odd-bg: rgb(250, 250, 250);
    --menu-item-hover-bg: rgb(220, 220, 220);
    --share-button-bg: rgb(255, 87, 87);
    --share-button-color: white;

    --screen-max-width: 800px;
    --screen-sides-overflow: rgba(250, 250, 250);
}
.dark {
    --square-bg-green: #426936;
    --square-bg-yellow: #e9ba3a;
    --square-bg-white: #b4b4b4;
    --square-color-green: #e7e7e7;
    --square-color-yellow: #e7e7e7;
    --square-color-white: #e7e7e7;
    --bg-white: black;
    --bg-black: white;
    --color-white: black;
    --color-black: #dedede;
    --overlay-bg: rgba(255, 255, 255,.3);
    --eee: #bbb;
    --888: #888;
    --menu-item-header-bg: rgb(30, 30, 30);
    --menu-item-even-bg: rgb(10, 10, 10);
    --menu-item-odd-bg: rgb(15, 15, 15);
    --menu-item-hover-bg: rgb(25, 25, 25);

    --screen-sides-overflow: rgba(5,5,5)
}
.high-contrast {
    --square-bg-green: #2dcc00;
    --square-bg-yellow: #0048ff;
    --square-bg-white: #e0e0e0;
    --square-color-green: #ffffff;
    --square-color-yellow: #ffffff;
    --square-color-white: #000000;
}

html, body {
    font-family: waffleFont, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-white);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    color: var(--color-black);
    position: relative;
}

html {
    max-width: 800px;
    margin:    0 auto;
    background-color: var(--screen-sides-overflow);
}
body {
    max-width: 800px;
}
.left-overlay {
    position: fixed;
    height: 100%;
    background-color: var(--screen-sides-overflow);
    width: calc(50% - (var(--screen-max-width) / 2));
    left: 0;
    z-index: 10000000;
}

*::-webkit-scrollbar {
    display: none;
}

.icon {
    background-color: var(--eee);
    width: 28px;
    height: 28px;
    border-radius: 5px;
    padding: 10px;
    cursor: pointer;
}


.container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    flex-direction: row;
    width: 100%;
    flex-basis: 70px;
    flex-grow: 0;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}
    .topbar .left {
        margin-left: 15px;
        flex-basis: 110px;
        /*margin-top: 10px;*/
        /*width: 110px;*/
    }
    .topbar .title {
        flex-grow: 1;
        flex-basis: 0;
        text-align: center;
        font-weight: bold;
        font-size: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--color-black)
    }
    .topbar .right {
        flex-basis: 110px;
        margin-right: 15px;
        display: flex;
        flex-direction: row;
        /*width: 110px;*/
    }
.game {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
    .level-name {
        text-align: center;
        font-size: 20px;
        min-height: 10%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        color: var(--888);
    }
    .game-container {
        flex-grow: 1;
        max-height: 500px;
        display: flex;
        flex-direction: row;
        justify-content: center;
    }
    .swaps-remaining {
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 10%;
        color: var(--888);
    }
    #swaps-remaining {
        color: var(--color-black);
        font-weight: bold;
        font-size: 20px;
    }
    .view-solution-container {
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 10%;
        color: var(--888);
    }
    .show-solution-button {
        background-color: var(--square-bg-green);
        color: var(--square-color-green);
        font-weight: bold;
        padding: 8px 10px;
        font-size: 20px;
        border-radius: 5px;
        cursor: pointer;
    }
    .share-result-button {
    background-color: var(--share-button-bg);
    color: var(--square-color-green);
    font-weight: bold;
    padding: 3px 10px;
    font-size: 18px;
    border-radius: 5px;
    cursor: pointer;
}
.bottom {
  height: 20%;
}
.ad-bottom {
padding-top: 1px;
}


.game-over {
    width: 100%;
    max-width: var(--screen-max-width);
    height: 100%;
    position: fixed;
    background-color: var(--overlay-bg);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.game-over-box {
    background-color: var(--bg-white);
    color: var(--color-black);
    width: 80%;
    max-width: 600px;
    height: 85%;
    max-height: 600px;
    border-radius: 5px;
    text-align: center;
    overflow-y: auto;
    position: relative;
}
    .game-over-time-until-next-sortix {
        position: absolute;
        width: 100%;
        bottom: -1%;
    }
.game-over-close {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
}
.solution {
    width: 250px;
    height: 250px;
    display: inline-flex;
    flex-direction: column;
}
.solution-row {
    display: flex;
    flex-direction: row;
}
.solution-tile {
    width: 49px;
    height: 49px;
    border-radius: 7px;
    margin: 2px;
    background-color: var(--square-bg-green);
    color: var(--square-color-green);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 30px;
}
.solution-tile-space {
    background-color: transparent;
}


.menu-overlay {
    width: 350px;
    z-index: 1000000;
    height: 100%;
    position: absolute;
    background-color: var(--bg-white);
    overflow-y: auto;
}
.menu-topbar {
    height: 70px;
    display: flex;
    flex-direction: row;
}
.menu-title {
    font-size: 30px;
    font-weight: bold;
    display: flex;
    align-items: center;
    margin-left: 20px;
    /*justify-content: center;*/
    flex-grow: 1;
}
.menu-close {
    padding: 5px;
    font-size: 35px;
    display: flex;
    align-items: center;
    margin-right: 20px;
    cursor: pointer;
}
.menu-list {
    /*height: 100%;*/
    overflow-y: auto;
}
.menu-list-header {
    width: 100%;
    height: 50px;
    background-color: var(--menu-item-header-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}
.menu-list-item {
    width: calc(100% - 5px);
    height: 50px;
    display: flex;
    align-items: center;
    padding-left: 5px;
    cursor: pointer;
    text-decoration: none;
    color: var(--color-black);
}
.menu-list-item:nth-child(even) {
    background-color: var(--menu-item-even-bg);
}
.menu-list-item:nth-child(odd) {
    background-color: var(--menu-item-odd-bg);
}
.menu-list-item:hover {
    background-color: var(--menu-item-hover-bg);
}


.stats-overlay {
    position: fixed;
    width: 100%;
    height: 100%;
    max-width: var(--screen-max-width);
    background-color: var(--bg-white);
    z-index: 10000;
    overflow-y: auto;
}
.stats-topbar {
    height: 70px;
    display: flex;
    flex-direction: row;
}
.stats-title {
    margin-left: 20px;
    font-size: 30px;
    display: flex;
    align-items: center;
    flex-grow: 1;
}
.stats-close {
    font-size: 35px;
    margin-right: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
}
.stats-content {
    margin-left: 20px;
    width: calc(100% - 40px);
    text-align: center;
}
.stats-table {
    width: 100%;
}
.stats-table th {
    text-align: right;
    padding-right: 10px;
}
.stats-table td {
    padding-right: 30px;
}
.stat-distribution-table {
    width:  80%;
    margin: 0 auto;
}
.sdt-left {
    width: 10%;
}
.sdt-count {
    width: 80%;
}
.sdt-bar {
    min-width: 10px;
    background-color: var(--eee);
    border-radius: 4px;
    text-align: right;
    padding: 0 5px;
}
.sdt-percent {
    padding-left: 5px;
    width: 10%;
}

.info-overlay {
    position: fixed;
    width: 100%;
    max-width: var(--screen-max-width);
    height: 100%;
    background-color: var(--bg-white);
    z-index: 10000;
    overflow-y: auto;
}
.info-topbar {
    height: 70px;
    display: flex;
    flex-direction: row;
}
.info-title {
    margin-left: 20px;
    font-size: 30px;
    display: flex;
    align-items: center;
    flex-grow: 1;
}
.info-close {
    font-size: 35px;
    margin-right: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
}
/* Desktop devices */
@media screen and (min-width: 768px) {
  .info-content {
    max-width: 66%;
    margin: 0 auto;
    font-size: 20px;
    text-align: justify;
  }
}
/* Mobile devices */
@media screen and (max-width: 767px) {
  .info-content {
    max-width: 80%;
    margin: 0 auto;
    font-size: 18px;
    text-align: justify;
  }
}


/* Base style for the #snackbar (hidden by default) */
#snackbar {
  visibility: hidden;      /* Not visible initially */
  opacity: 0;             /* Start fully transparent */
  background-color: #fff !important; /* Force white background, even in dark mode */
  color: #000 !important;            /* Force black text, even in dark mode */
  min-width: 120px;       /* Keep it small */
  text-align: center;
  border-radius: 6px;
  border: 1px solid #ccc;
  padding: 8px 12px;
  position: fixed;
  z-index: 99999;         /* High enough to appear on top of everything */
  left: 50%;              
  top: 50%;               
  transform: translate(-50%, -50%);
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: visibility 0.3s, opacity 0.3s; /* Fade transitions */
}

/* When we add "show", the snackbar becomes visible and fades in */
#snackbar.show {
  visibility: visible;
  opacity: 1;
}





.wgame {
    /*width: 500px;*/
    aspect-ratio: 1 / 1;
    user-select: none !important;
    max-height: 100%;
}

.wtiles {
    position: absolute;
}

.tile {
    cursor: pointer;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    border-radius: 12%;
    transition: background-color 100ms, color 100ms, font-size 100ms;
    border-bottom: 3px solid rgba(0,0,0,.1);
    transform: scale(90%);
}
.tile.green {
    background-color: var(--square-bg-green);
    color: var(--square-color-green);
}
.tile.yellow {
    background-color: var(--square-bg-yellow);
    color: var(--square-color-yellow);
}
.tile.white {
    background-color: var(--square-bg-white);
    color: var(--square-color-white);
}

.letter {
    font-size: 70px;
    font-weight: bold;
}

/** small screens **/
@media only screen and (max-width: 440px) {
    .icon {
        width: 22px;
        height: 22px;
    }

    .topbar .left {
        flex-basis: 90px;
        margin-left: 5px;
    }
    .topbar .right {
        flex-basis: 90px;
        margin-right: 5px;
    }

    .topbar .title {
        font-size: 34px;
    }

    .show-solution-button {
        padding: 5px 7px;
        font-size: 16px;
    }
}

/* Mobile devices with screen width less than 800px */
@media screen and (max-width: 7799px) {
    .container {
        padding-bottom: 150px; /* Adjust the value based on the desired space */
    }
}

.hidden {
    display: none !important;
}

/* Ensure popup text is black in all modes */
.popup {
  color: black !important;
}

/* Also force popup headings to be black */
.popup .popup-heading {
  color: black !important;
}

.dark .popup {
  color: black !important;
}

/* Default styling for the transfer buttons */
.transfer-btn {
  background-color: #ccc;      /* default grey */
  color: #000;
  border: 1px solid #999;      /* slightly bolder border */
  border-radius: 4px;
  padding: 8px 10px;
  font-weight: normal;
  cursor: pointer;
}

/* Active button uses the green from your game-over solution button */
.transfer-btn.active {
  background-color: var(--square-bg-green);
  color: var(--square-color-green);
  border: 2px solid var(--square-bg-green);
  font-weight: bold;
}
