@import url(fonts/clear-sans.css);
 .tile-inner2,  .tile-inner4,  .tile-inner8,  .tile-inner16,  .tile-inner32,  .tile-inner64,  .tile-inner128,  .tile-inner256,  .tile-inner512,  .tile-inner1024,  .tile-inner2048  { 
    border-radius: 3px;
     width: 107px;
  height: 107px;
}
.gameName {
  margin: 0;
  padding: 0;
  color: #776e65;
  font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  font-style: italic;
  font-weight: 200;
}
.go {
  display: inline-block;
  background: #8f7a66;
  border-radius: 3px;
  padding: 0px 20px;
  text-decoration: none;
  color: #f9f6f2;
  margin: 9px 9px 9px 9px;
  height: 40px;
  line-height: 42px;
  text-align: center;
}
.restart-button:active, .restart-button2:active, .save-button:active, .game-button:active, .continue-button:active, .start-new-button:active, .paused-button:active, .restart-button3:active {
transform: scale(1.1,1.1);
}
.game-button:hover,  {
curser: pointer;
}
.restore-message {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(238, 228, 218, 0.85);
    z-index: 100;
    text-align: center;
    -webkit-animation: fade-in 800ms ease 1200ms;
    -moz-animation: fade-in 800ms ease 1200ms;
    animation: fade-in 800ms ease 1200ms;
    -webkit-animation-fill-mode: both;
    -moz-animation-fill-mode: both;
    animation-fill-mode: both; 
}

.save-button {
  display: inline-block;
  background: #8f7a66;
  border-radius: 3px;
  padding: 0px 20px;
  text-decoration: none;
  color: #f9f6f2;
  margin: 9px 9px 9px 9px;
  height: 40px;
  line-height: 42px;
  text-align: center;
}
.game-button {
  display: inline-block;
  background: #8f7a66;
  border-radius: 3px;
  padding: 0px 20px;
  text-decoration: none;
  color: #f9f6f2;
  margin: 9px 9px 9px 9px;
  height: 40px;
  line-height: 42px;
  text-align: center;
}
.game-button:hover {
cursor: pointer;
}
@media screen and (max-width: 520px) {
  .lower-hide {
    margin-top: 30px !important; 
     }
}
.lower-hide {
     display: block;
     margin-top: 59px; 
}
@media screen and (max-width: 520px) {
  .restore-hide {
    margin-top: 30px !important; 
     }
}
.restore-hide {
     display: block;
     margin-top: 59px; 
}
.continue-button {
    display: none;
    background: #8f7a66;
    border-radius: 3px;
    padding: 5px 20px;
    text-decoration: none;
    color: #f9f6f2;
    height: 40px;
    line-height: 42px;
    margin: 9px 9px 9px 9px;
}
.start-new-button {
    display: none;
    background: #8f7a66;
    border-radius: 3px;
    padding: 5px 20px;
    text-decoration: none;
    color: #f9f6f2;
    height: 40px;
    line-height: 42px;
    margin: 9px 9px 9px 9px;
}
.paused-button {
    display: none;
    background: #8f7a66;
    border-radius: 3px;
    padding: 5px 20px;
    text-decoration: none;
    color: #f9f6f2;
    height: 40px;
    line-height: 42px;
    margin: 9px 9px 9px 9px;
}
.login-hide {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(238, 228, 218, 0.5);
    z-index: 100;
    text-align: center;
    -webkit-animation: fade-in 800ms ease 1200ms;
    -moz-animation: fade-in 800ms ease 1200ms;
    animation: fade-in 800ms ease 1200ms;
    -webkit-animation-fill-mode: both;
    -moz-animation-fill-mode: both;
    animation-fill-mode: both; 
}
.vertical-seperate {
  border-left: 1px solid #d8d4d0;
  width: 1px;
  max-width: 1px;
}
.profile-desc {
  padding-right: 10px;
  font-size: 15px;
  max-width: 300px;
  margin: 0;
}
.profile {
  display: flex;
  justify-content: flex-end;
}
.profile-picture {
  margin-left: 10px;
  max-width: 29px;
  background-image: url('../img/2.png');
  background-repeat: no-repeat;
  background-size: contain; 
  width: 29px;
  height: 29px;
  flex: 1; 
}
.restart-button3 {
  margin: 9px 9px 9px 9px;
  display: none;
  background: #8f7a66;
  border-radius: 3px;
  padding: 0 20px;
  text-decoration: none;
  color: #f9f6f2;
  height: 40px;
  line-height: 42px;
  text-align: center;
}
#container-above-game2 {
  display: flex;
}
#firebaseui-auth-container {
  border: none;
  border-left: 1px solid #d8d4d0;
}
#firebaseui-auth2 .title2 {
      align-self: center;
}
#firebaseui-auth2 .title2,.firebaseui-auth-container {
 flex: 1;
}
#firebaseui-auth2 {
display: none;
}
.above-game2:after {
  content: "";
  display: block;
  clear: both; 
}
#firebaseui-auth-container {
  display: none;
}
#loader {
  display: none;
}
.game-intro2 {
  line-height: 42px;
  margin-bottom: 0;
}
.restart-button2 {
  display: inline-block;
  background: #8f7a66;
  border-radius: 3px;
  padding: 0 20px;
  margin: 9px 9px 9px 9px;
  text-align: center;
  text-decoration: none;
  color: #f9f6f2;
  height: 40px;
  line-height: 42px;
}
.game-explanation2 {
  margin-top: 50px; 
}
.go {
margin-top: 15px;
}
.container-flex {
  display: flex;
  flex-wrap: wrap;
}
.container-flex :nth-child(odd) {
  flex: 1;
  width: 100%;
  min-width:  280px;
}

.container-flex :nth-child(even) {
  flex: 1;
  width: 100%;
  min-width:  280px;
}
::-webkit-input-placeholder {
  color: rgb(169, 169, 169);
  font-style: italic;
}
:-ms-input-placeholder {
  color: rgb(169, 169, 169);
  font-style: italic;
}
::placeholder {
  color: rgb(169, 169, 169);
  font-style: italic;
}
textarea {
  margin-bottom: 15px;
  rows: 1;
  width: 100%;
}
html, body {
  margin: 0;
  padding: 0;
  background: #faf8ef;
  color: #776e65;
  font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 18px; }

body {
  margin: 20px 0; }

.heading:after {
  content: "";
  display: block;
  clear: both; }

h1.title {
  font-size: 80px;
  font-weight: bold;
  margin: 0;
  display: block;
  float: left; }

@-webkit-keyframes move-up {
  0% {
    top: 25px;
    opacity: 1; }

  100% {
    top: -50px;
    opacity: 0; } }

@-moz-keyframes move-up {
  0% {
    top: 25px;
    opacity: 1; }

  100% {
    top: -50px;
    opacity: 0; } }

@keyframes move-up {
  0% {
    top: 25px;
    opacity: 1; }

  100% {
    top: -50px;
    opacity: 0; } }

.scores-container {
  float: right;
  text-align: right; }

.score-container, .best-container {
  position: relative;
  display: inline-block;
  background: #bbada0;
  padding: 15px 25px;
  font-size: 25px;
  height: 25px;
  line-height: 47px;
  font-weight: bold;
  border-radius: 3px;
  color: white;
  margin-top: 8px;
  text-align: center; }

.score-container:after, .best-container:after {
    position: absolute;
    width: 100%;
    top: 10px;
    left: 0;
    text-transform: uppercase;
    font-size: 13px;
    line-height: 13px;
    text-align: center;
    color: #eee4da; }

.score-container .score-addition, .best-container .score-addition {
    position: absolute;
    right: 30px;
    color: red;
    font-size: 25px;
    line-height: 25px;
    font-weight: bold;
    color: rgba(119, 110, 101, 0.9);
    z-index: 100;
    -webkit-animation: move-up 600ms ease-in;
    -moz-animation: move-up 600ms ease-in;
    animation: move-up 600ms ease-in;
    -webkit-animation-fill-mode: both;
    -moz-animation-fill-mode: both;
    animation-fill-mode: both; 
}

.score-container:after {
  content: "Score"; }

.best-container:after {
  content: "Best"; }

p {
  margin-top: 0;
  margin-bottom: 10px;
  line-height: 1.65; }

a {
  color: #776e65;
  font-weight: bold;
  text-decoration: underline;
  cursor: pointer; }

strong.important {
  text-transform: uppercase; }

hr {
  border: none;
  border-bottom: 1px solid #d8d4d0;
  margin-top: 20px;
  margin-bottom: 30px; }

.container {
  width: 500px;
  margin: 0 auto; }

@-webkit-keyframes fade-in {
  0% {
    opacity: 0; }

  100% {
    opacity: 1; } }
@-moz-keyframes fade-in {
  0% {
    opacity: 0; }

  100% {
    opacity: 1; } }
@keyframes fade-in {
  0% {
    opacity: 0; }

  100% {
    opacity: 1; } }

.game-container {
  margin-top: 40px;
  position: relative;
  padding: 15px;
  cursor: default;
  -webkit-touch-callout: none;
  -ms-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -ms-touch-action: none;
  touch-action: none;
  background: #bbada0;
  border-radius: 6px;
  width: 500px;
  height: 500px;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box; }

.game-container .game-message {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(238, 228, 218, 0.5);
    z-index: 100;
    text-align: center;
    -webkit-animation: fade-in 800ms ease 1200ms;
    -moz-animation: fade-in 800ms ease 1200ms;
    animation: fade-in 800ms ease 1200ms;
    -webkit-animation-fill-mode: both;
    -moz-animation-fill-mode: both;
    animation-fill-mode: both; }

.game-container .game-message p {
      font-size: 60px;
      font-weight: bold;
      height: 60px;
      line-height: 60px;
      margin-top: 222px; }

.game-container .game-message .lower {
      display: block;
      margin-top: 59px; }
 
.game-container .game-message a {
      display: inline-block;
      background: #8f7a66;
      border-radius: 3px;
      padding: 0 20px;
      text-decoration: none;
      color: #f9f6f2;
      height: 40px;
      line-height: 42px;
      margin-left: 9px; }

.game-container .game-message a.` {
        display: none; }

.game-container .game-message.game-won {
      background: rgba(237, 194, 46, 0.5);
      color: #f9f6f2; }
      
.game-container .game-message.game-won a.keep-playing-button {
        display: inline-block; }
   
.game-container .game-message.game-won, .game-container .game-message.game-over {
      display: block; }

.grid-container {
  position: absolute;
  z-index: 1; }

.grid-row {
  margin-bottom: 15px; }

.grid-row:last-child {
    margin-bottom: 0; }

.grid-row:after {
    content: "";
    display: block;
    clear: both; }

.grid-cell {
  width: 106.25px;
  height: 106.25px;
  margin-right: 15px;
  float: left;
  border-radius: 3px;
  background: rgba(238, 228, 218, 0.35); }

.grid-cell:last-child {
    margin-right: 0; }

.tile-container {
  position: absolute;
  z-index: 2; }

.tile, .tile .tile-inner {
  width: 107px;
  height: 107px;
  line-height: 116.25px; }

.tile.tile-position-1-1 {
  -webkit-transform: translate(0px, 0px);
  -moz-transform: translate(0px, 0px);
  transform: translate(0px, 0px); }

.tile.tile-position-1-2 {
  -webkit-transform: translate(0px, 121px);
  -moz-transform: translate(0px, 121px);
  transform: translate(0px, 121px); }

.tile.tile-position-1-3 {
  -webkit-transform: translate(0px, 242px);
  -moz-transform: translate(0px, 242px);
  transform: translate(0px, 242px); }

.tile.tile-position-1-4 {
  -webkit-transform: translate(0px, 363px);
  -moz-transform: translate(0px, 363px);
  transform: translate(0px, 363px); }

.tile.tile-position-2-1 {
  -webkit-transform: translate(121px, 0px);
  -moz-transform: translate(121px, 0px);
  transform: translate(121px, 0px); }

.tile.tile-position-2-2 {
  -webkit-transform: translate(121px, 121px);
  -moz-transform: translate(121px, 121px);
  transform: translate(121px, 121px); }

.tile.tile-position-2-3 {
  -webkit-transform: translate(121px, 242px);
  -moz-transform: translate(121px, 242px);
  transform: translate(121px, 242px); }

.tile.tile-position-2-4 {
  -webkit-transform: translate(121px, 363px);
  -moz-transform: translate(121px, 363px);
  transform: translate(121px, 363px); }

.tile.tile-position-3-1 {
  -webkit-transform: translate(242px, 0px);
  -moz-transform: translate(242px, 0px);
  transform: translate(242px, 0px); }

.tile.tile-position-3-2 {
  -webkit-transform: translate(242px, 121px);
  -moz-transform: translate(242px, 121px);
  transform: translate(242px, 121px); }

.tile.tile-position-3-3 {
  -webkit-transform: translate(242px, 242px);
  -moz-transform: translate(242px, 242px);
  transform: translate(242px, 242px); }

.tile.tile-position-3-4 {
  -webkit-transform: translate(242px, 363px);
  -moz-transform: translate(242px, 363px);
  transform: translate(242px, 363px); }

.tile.tile-position-4-1 {
  -webkit-transform: translate(363px, 0px);
  -moz-transform: translate(363px, 0px);
  transform: translate(363px, 0px); }

.tile.tile-position-4-2 {
  -webkit-transform: translate(363px, 121px);
  -moz-transform: translate(363px, 121px);
  transform: translate(363px, 121px); }

.tile.tile-position-4-3 {
  -webkit-transform: translate(363px, 242px);
  -moz-transform: translate(363px, 242px);
  transform: translate(363px, 242px); }

.tile.tile-position-4-4 {
  -webkit-transform: translate(363px, 363px);
  -moz-transform: translate(363px, 363px);
  transform: translate(363px, 363px); }

.tile {
  position: absolute;
  -webkit-transition: 100ms ease-in-out;
  -moz-transition: 100ms ease-in-out;
  transition: 100ms ease-in-out;
  -webkit-transition-property: -webkit-transform;
  -moz-transition-property: -moz-transform;
  transition-property: transform; }

.tile .tile-inner {
    border-radius: 3px;
    background: #eee4da;
    text-align: center;
    font-weight: bold;
    z-index: 10;
    font-size: 0px; }
  .tile.tile-2 .tile-inner, .tile-inner2 {
    background-image: url('../img/2.png');
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0);
 }
  .tile.tile-4 .tile-inner, .tile-inner4 {
    background-image: url('../img/4.png');
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0); }
  .tile.tile-8 .tile-inner, .tile-inner8 {
    background-image: url('../img/8.png');
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0);
}
  .tile.tile-16 .tile-inner, .tile-inner16 {
    background-image: url('../img/16.png');
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0);
}
  .tile.tile-32 .tile-inner, .tile-inner32 {
    background-image: url('../img/32.png');
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0);
}
  .tile.tile-64 .tile-inner, .tile-inner64 {
    background-image: url('../img/64.png');
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0);
}
  .tile.tile-128 .tile-inner, .tile-inner128 {
    background-image: url('../img/128.png');
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0); }
    @media screen and (max-width: 520px) {
      .tile.tile-128 .tile-inner {
        font-size: 0px; 
      } 
    }
  .tile.tile-256 .tile-inner, .tile-inner256 {
    background-image: url('../img/256.png');
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0);
    }
    @media screen and (max-width: 520px) {
      .tile.tile-256 .tile-inner {
        font-size: 0px; } }
  .tile.tile-512 .tile-inner, .tile-inner512 {
    background-image: url('../img/512.png');
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0);
    }
    @media screen and (max-width: 520px) {
      .tile.tile-512 .tile-inner {
        font-size: 0px; } }
  .tile.tile-1024 .tile-inner, .tile-inner1024 {
    background-image: url('../img/1024.png');
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0);
    }
    @media screen and (max-width: 520px) {
      .tile.tile-1024 .tile-inner {
        font-size: 0px; } }
  .tile.tile-2048 .tile-inner, .tile-inner2048 {
     background-image: url('../img/2048.png');
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0), inset 0 0 0 1px rgba(255, 255, 255, 0);
    }
    @media screen and (max-width: 520px) {
      .tile.tile-2048 .tile-inner {
        font-size: 0px; } }
  .tile.tile-super .tile-inner {
    color: #f9f6f2;
    background: #3c3a32;
    font-size: 0px; }
    @media screen and (max-width: 520px) {
      .tile.tile-super .tile-inner {
        font-size: 0px; } }

@-webkit-keyframes appear {
  0% {
    opacity: 0;
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0); }

  100% {
    opacity: 1;
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1); } }
@-moz-keyframes appear {
  0% {
    opacity: 0;
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0); }

  100% {
    opacity: 1;
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1); } }
@keyframes appear {
  0% {
    opacity: 0;
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0); }

  100% {
    opacity: 1;
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1); } }
.tile-new .tile-inner {
  -webkit-animation: appear 200ms ease 100ms;
  -moz-animation: appear 200ms ease 100ms;
  animation: appear 200ms ease 100ms;
  -webkit-animation-fill-mode: backwards;
  -moz-animation-fill-mode: backwards;
  animation-fill-mode: backwards; }

@-webkit-keyframes pop {
  0% {
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0); }

  50% {
    -webkit-transform: scale(1.2);
    -moz-transform: scale(1.2);
    transform: scale(1.2); }

  100% {
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1); } }
@-moz-keyframes pop {
  0% {
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0); }

  50% {
    -webkit-transform: scale(1.2);
    -moz-transform: scale(1.2);
    transform: scale(1.2); }

  100% {
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1); } }
@keyframes pop {
  0% {
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0); }

  50% {
    -webkit-transform: scale(1.2);
    -moz-transform: scale(1.2);
    transform: scale(1.2); }

  100% {
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1); } }
.tile-merged .tile-inner {
  z-index: 20;
  -webkit-animation: pop 200ms ease 100ms;
  -moz-animation: pop 200ms ease 100ms;
  animation: pop 200ms ease 100ms;
  -webkit-animation-fill-mode: backwards;
  -moz-animation-fill-mode: backwards;
  animation-fill-mode: backwards; 
    }

.above-game:after {
  content: "";
  display: flex;
  clear: both; 
    }

.game-intro {
  line-height: 42px;
  margin-bottom: 0; 
    }

.restart-button {
  display: inline-block;
  background: #8f7a66;
  border-radius: 3px;
  padding: 0 20px;
  text-align: center;
  text-decoration: none;
  color: #f9f6f2;
  height: 40px;
  line-height: 42px;
    }
.game-explanation {
  margin-top: 50px; }

@media screen and (max-width: 520px) {
  html, body {
    font-size: 15px; }
   .tile {
     background-repeat: no-repeat; 
     background-position: center center; 
  }
  body {
    margin: 20px 0;
    padding: 0 20px; }

  h1.title {
    font-size: 27px;
    margin-top: 15px; }

  .container {
    width: 280px;
    margin: 0 auto; }

  .score-container, .best-container {
    margin-top: 0;
    padding: 15px 10px;
    min-width: 40px; }

  .heading {
    margin-bottom: 10px; }

  .game-intro {
    width: 55%;
    display: block;
    box-sizing: border-box;
    line-height: 1.65; }

  .restart-button {
    width: 42%;
    padding: 0;
    display: block;
    text-align: center;
    box-sizing: border-box;
    margin-top: 2px; }

  .game-container {
    margin-top: 17px;
    position: relative;
    padding: 10px;
    cursor: default;
    -webkit-touch-callout: none;
    -ms-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -ms-touch-action: none;
    touch-action: none;
    background: #bbada0;
    border-radius: 6px;
    width: 280px;
    height: 280px;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box; }
    .game-container .game-message {
      display: none;
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      background: rgba(238, 228, 218, 0.5);
      z-index: 100;
      text-align: center;
      -webkit-animation: fade-in 800ms ease 1200ms;
      -moz-animation: fade-in 800ms ease 1200ms;
      animation: fade-in 800ms ease 1200ms;
      -webkit-animation-fill-mode: both;
      -moz-animation-fill-mode: both;
      animation-fill-mode: both; }
      .game-container .game-message p {
        font-size: 60px;
        font-weight: bold;
        height: 60px;
        line-height: 60px;
        margin-top: 222px; }
      .game-container .game-message .lower {
        display: block;
        margin-top: 59px; }
      .game-container .game-message a {
        display: inline-block;
        background: #8f7a66;
        border-radius: 3px;
        padding: 0 20px;
        text-decoration: none;
        color: #f9f6f2;
        height: 40px;
        line-height: 42px;
        margin-left: 9px; }
        .game-container .game-message a.keep-playing-button {
          display: none; }
      .game-container .game-message.game-won {
        background: rgba(237, 194, 46, 0.5);
        color: #f9f6f2; }
        .game-container .game-message.game-won a.keep-playing-button {
          display: inline-block; }
      .game-container .game-message.game-won, .game-container .game-message.game-over {
        display: block; }

  .grid-container {
    position: absolute;
    z-index: 1; }

  .grid-row {
    margin-bottom: 10px; }
    .grid-row:last-child {
      margin-bottom: 0; }
    .grid-row:after {
      content: "";
      display: block;
      clear: both; }

  .grid-cell {
    width: 57.5px;
    height: 57.5px;
    margin-right: 10px;
    float: left;
    border-radius: 3px;
  }
  
  .grid-cell:last-child {
      margin-right: 0; }

  .tile-container {
    position: absolute;
    z-index: 2; }

  .tile, .tile .tile-inner {
    width: 58px;
    height: 58px;
    line-height: 67.5px; }
  .tile.tile-position-1-1 {
    -webkit-transform: translate(0px, 0px);
    -moz-transform: translate(0px, 0px);
    transform: translate(0px, 0px); }
  .tile.tile-position-1-2 {
    -webkit-transform: translate(0px, 67px);
    -moz-transform: translate(0px, 67px);
    transform: translate(0px, 67px); }
  .tile.tile-position-1-3 {
    -webkit-transform: translate(0px, 135px);
    -moz-transform: translate(0px, 135px);
    transform: translate(0px, 135px); }
  .tile.tile-position-1-4 {
    -webkit-transform: translate(0px, 202px);
    -moz-transform: translate(0px, 202px);
    transform: translate(0px, 202px); }
  .tile.tile-position-2-1 {
    -webkit-transform: translate(67px, 0px);
    -moz-transform: translate(67px, 0px);
    transform: translate(67px, 0px); }
  .tile.tile-position-2-2 {
    -webkit-transform: translate(67px, 67px);
    -moz-transform: translate(67px, 67px);
    transform: translate(67px, 67px); }
  .tile.tile-position-2-3 {
    -webkit-transform: translate(67px, 135px);
    -moz-transform: translate(67px, 135px);
    transform: translate(67px, 135px); }
  .tile.tile-position-2-4 {
    -webkit-transform: translate(67px, 202px);
    -moz-transform: translate(67px, 202px);
    transform: translate(67px, 202px); }
  .tile.tile-position-3-1 {
    -webkit-transform: translate(135px, 0px);
    -moz-transform: translate(135px, 0px);
    transform: translate(135px, 0px); }
  .tile.tile-position-3-2 {
    -webkit-transform: translate(135px, 67px);
    -moz-transform: translate(135px, 67px);
    transform: translate(135px, 67px); }
  .tile.tile-position-3-3 {
    -webkit-transform: translate(135px, 135px);
    -moz-transform: translate(135px, 135px);
    transform: translate(135px, 135px); }
  .tile.tile-position-3-4 {
    -webkit-transform: translate(135px, 202px);
    -moz-transform: translate(135px, 202px);
    transform: translate(135px, 202px); }
  .tile.tile-position-4-1 {
    -webkit-transform: translate(202px, 0px);
    -moz-transform: translate(202px, 0px);
    transform: translate(202px, 0px); }
  .tile.tile-position-4-2 {
    -webkit-transform: translate(202px, 67px);
    -moz-transform: translate(202px, 67px);
    transform: translate(202px, 67px); }
  .tile.tile-position-4-3 {
    -webkit-transform: translate(202px, 135px);
    -moz-transform: translate(202px, 135px);
    transform: translate(202px, 135px); }
  .tile.tile-position-4-4 {
    -webkit-transform: translate(202px, 202px);
    -moz-transform: translate(202px, 202px);
    transform: translate(202px, 202px); }

  .tile .tile-inner {
    font-size: 0px; }

  .game-message p {
    font-size: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
    margin-top: 90px !important; }
  .game-message .lower {
    margin-top: 30px !important; } }

/* === Dark mode slider control === */
.switch {
  position: relative;
  display: inline-block;
  width: 46px; height: 24px;
}
.switch input { display:none; }
.switch .slider {
  position:absolute; inset:0;
  border-radius: 24px;
  background: #bbb; cursor:pointer;
  transition: transform .2s, background .2s;
}
.switch .slider:before {
  content:"";
  position:absolute; left:3px; top:3px;
  width:18px; height:18px; border-radius:50%;
  background:#fff; transition: transform .2s;
}
.switch input:checked + .slider { background:#6a9cff; }
.switch input:checked + .slider:before { transform: translateX(22px); }

/* === Light/Dark theme variables === */
:root {
  --bg: #faf8ef;          /* page background */
  --text: #776e65;        /* base text */
  --board: #bbada0;       /* board background */
  --grid-cell: rgba(238,228,218,.35);
  --overlay: rgba(238,228,218,.5);
  --score-bg: #bbada0;
  --button-bg: #8f7a66;
  --link: #776e65;
}

html[data-theme="dark"] {
  --bg: #121212;
  --text: #e7e3da;
  --board: #3a3a3a;
  --grid-cell: rgba(255,255,255,.06);
  --overlay: rgba(0,0,0,.5);
  --score-bg: #4a4037;
  --button-bg: #5c4f43;
  --link: #e7e3da;
}

/* === Soft overrides to map existing styles to variables === */
html, body { background: var(--bg) !important; color: var(--text) !important; }
a { color: var(--link) !important; }

.game-container { background-color: var(--board) !important; }
.grid-cell { background: var(--grid-cell) !important; }         /* cells */  /* was rgba(238,228,218,.35) */ /* :contentReference[oaicite:5]{index=5} */
.game-container .game-message { background: var(--overlay) !important; }     /* overlay */ /* was rgba(238,228,218,.5) */ /* :contentReference[oaicite:6]{index=6} */

.score-container, .best-container {
  background: var(--score-bg) !important;
  color: var(--text) !important;
} /* originally #bbada0 + white */ /* :contentReference[oaicite:7]{index=7} */

.restart-button, .restart-button2, .save-button, .game-button,
.continue-button, .start-new-button, .paused-button, .restart-button3 {
  background: var(--button-bg) !important;
  color: #f9f6f2 !important;
} /* originally #8f7a66 */ /* :contentReference[oaicite:8]{index=8} */

/* Share box & misc borders look nicer in dark */
.share-section { border-color: rgba(0,0,0,.15); }
html[data-theme="dark"] .share-section { border-color: rgba(255,255,255,.15); }

/* ==== Responsive board that fills screen with 8px gutters ==== */

/* Tunables */
:root {
  --gutter: 8px;           /* outer page gutter on all sides */
  --board-pad: 15px;       /* the inner padding your board already uses */
  --gap: 15px;             /* the space between grid cells */
}

/* The board should be a square that fits within the smaller viewport side,
   minus the 8px gutters (left+right OR top+bottom = 16px total). */
:root {
  /* Use 100vmin so it never exceeds either dimension; subtract both gutters */
  --board-size: var(--board-size-dyn, calc(100svmin - (var(--gutter) * 2)));
  /* One tile side length */
  --tile-size: calc(
    (var(--board-size) - (var(--board-pad) * 2) - (var(--gap) * 3)) / 4
  );
  /* Step between tile origins (tile size + gap) */
  --step: calc(var(--tile-size) + var(--gap));
}

/* Page/container sizing */
html, body {
  /* guarantees 8px gutters even if some other block goes full-width */
  padding: var(--gutter);
  box-sizing: border-box;
}

.container {
  /* match the width to the board so header/scores align visually */
  width: var(--board-size) !important;
  max-width: calc(100vw - var(--gutter) * 2);
  margin: 0 auto;
}

/* Board frame */
.game-container {
  width: var(--board-size) !important;
  height: var(--board-size) !important;
  padding: var(--board-pad) !important;
}

/* The static background grid (the 16 “holes”) */
.grid-container,
.tile-container {
  width: calc(var(--board-size) - var(--board-pad) * 2) !important;
  height: calc(var(--board-size) - var(--board-pad) * 2) !important;
}

/* Background grid cells */
.grid-cell {
  width: var(--tile-size) !important;
  height: var(--tile-size) !important;
  margin-right: var(--gap) !important;
}
.grid-cell:last-child { margin-right: 0 !important; }
.grid-row { margin-bottom: var(--gap) !important; }
.grid-row:last-child { margin-bottom: 0 !important; }

/* Foreground tiles (your image tiles) */
.tile .tile-inner,
.tile .tile-inner2, .tile .tile-inner4, .tile .tile-inner8,
.tile .tile-inner16, .tile .tile-inner32, .tile .tile-inner64,
.tile .tile-inner128, .tile .tile-inner256, .tile .tile-inner512,
.tile .tile-inner1024, .tile .tile-inner2048 {
  width: var(--tile-size) !important;
  height: var(--tile-size) !important;
  line-height: var(--tile-size) !important; /* if any text tiles appear */
}

/* ==== Override the fixed pixel transforms with variable-based ones ==== */
/* Each class moves the tile by N * --step in X and/or Y.                 */
/* (These rules intentionally appear AFTER the original ones.)             */
.tile.tile-position-1-1 { transform: translate(0, 0) !important; }
.tile.tile-position-1-2 { transform: translate(0, calc(var(--step) * 1)) !important; }
.tile.tile-position-1-3 { transform: translate(0, calc(var(--step) * 2)) !important; }
.tile.tile-position-1-4 { transform: translate(0, calc(var(--step) * 3)) !important; }

.tile.tile-position-2-1 { transform: translate(calc(var(--step) * 1), 0) !important; }
.tile.tile-position-2-2 { transform: translate(calc(var(--step) * 1), calc(var(--step) * 1)) !important; }
.tile.tile-position-2-3 { transform: translate(calc(var(--step) * 1), calc(var(--step) * 2)) !important; }
.tile.tile-position-2-4 { transform: translate(calc(var(--step) * 1), calc(var(--step) * 3)) !important; }

.tile.tile-position-3-1 { transform: translate(calc(var(--step) * 2), 0) !important; }
.tile.tile-position-3-2 { transform: translate(calc(var(--step) * 2), calc(var(--step) * 1)) !important; }
.tile.tile-position-3-3 { transform: translate(calc(var(--step) * 2), calc(var(--step) * 2)) !important; }
.tile.tile-position-3-4 { transform: translate(calc(var(--step) * 2), calc(var(--step) * 3)) !important; }

.tile.tile-position-4-1 { transform: translate(calc(var(--step) * 3), 0) !important; }
.tile.tile-position-4-2 { transform: translate(calc(var(--step) * 3), calc(var(--step) * 1)) !important; }
.tile.tile-position-4-3 { transform: translate(calc(var(--step) * 3), calc(var(--step) * 2)) !important; }
.tile.tile-position-4-4 { transform: translate(calc(var(--step) * 3), calc(var(--step) * 3)) !important; }

/* Bottom-right numeric badge (JS-driven) */
.tile .tile-inner { position: relative; }

.tile-badge {
  position: absolute;
  right: 4px;    /* small right gutter */
  bottom: 4px;   /* small bottom gutter */
  color: #fff;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  z-index: 20;

  /* Text lift (shadow) */
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);

  /* <= 25% of tile height */
  font-size: clamp(9px, calc(var(--tile-size, 107px) * 0.25), calc(var(--tile-size, 107px) * 0.25));
  );
}

/* Hide numeric badges when the toggle is off */
html[data-show-nums="0"] .tile-badge { display: none !important; }

/* Make non-square images auto-crop to the square tile area */
.tile .tile-inner{
  width:100%;
  height:100%;
  display:block;

  /* the magic: fills the square and crops overflow */
  background-size: cover;          /* no stretching, fill & crop */
  background-position: center;     /* center the crop */
  background-repeat: no-repeat;    /* no tiling */

  /* keeps numbers readable if you show them */
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}

/* Highest-tile background styling */
.game-container.byobg-on {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* A touch of gray to keep tiles readable */
  background-image: var(--byo-bg-layer), var(--byo-bg-image);
  /* default overlay; JS will set the image layer */
  --byo-bg-layer: linear-gradient(rgba(0,0,0,.22), rgba(0,0,0,.22));
  --byo-bg-image: none;
}

/* If a tile contains an <img>, make it fill the square without distortion */
.tile .tile-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;      /* <- preserves aspect ratio, crops overflow */
  object-position: center;
  display: block;         /* remove any inline-gap from default inline images */
}
