:root {
  --colorA: #ff165d;
  --colorB: #0f3394;
  --colorC: #485f7a;
  --colorD: #ffa007;

  --sliderSize: 85px;
  --sliderFontSize: 24px;
}

* {
  box-sizing: border-box;
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  padding: 0;
}

h1,
h2,
h3,
h4,
h5 {
  margin: 0;
  font-family: "Contrail One", sans-serif;
}

.game-body {
  display: flex;
  gap: 10px;
}

.home {
  background-color: #ffffff;
  position: relative;
}

.line {
  --mask: radial-gradient(
        78.68px at calc(100% + 66px) 50%,
        #0000 calc(99% - 3px),
        #000 calc(101% - 3px) 99%,
        #0000 101%
      )
      calc(50% - 21.5px + 0.5px) calc(50% - 80px) / 43px 160px repeat-y,
    radial-gradient(
        78.68px at -66px 50%,
        #0000 calc(99% - 3px),
        #000 calc(101% - 3px) 99%,
        #0000 101%
      )
      calc(50% + 21.5px) 50%/43px 160px repeat-y;
  -webkit-mask: var(--mask);
  mask: var(--mask);

  position: absolute;
  top: -60px;
  left: 50%;
  width: 100px;
  height: calc(100% + 150px);
  background: var(--colorA);
  background: linear-gradient(0deg, var(--colorB) 0%, var(--colorA) 70%, var(--colorA) 100%);
  transform: translateX(-50%);
  z-index: -1;
}

.sidebar {
  min-width: 360px;
  width: 360px;
  height: 100vh;
  display: flex;
  /* justify-content: space-between; */
  flex-direction: column;
  padding: 10px;
  border-right: 3px solid #eee;
  font-family: "Contrail One", sans-serif;
  background: #f9f9f9;
  gap: 8px;
  overflow: scroll;
}

.tableWrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  background: white;
}

.table,
.bg-table {
  display: block;
  border-radius: 10px;
  padding: 30px;
  font-size: 0;
}

.table {
  transform: translateZ(0);
  z-index: 2;
}

.table:not(.bg-table) {
  box-shadow: inset 0px 0px 4px 1px rgb(0 0 0 / 15%);
}

.bg-table {
  position: absolute;
  pointer-events: none;
  background: white;
  z-index: 1;
}

.bg-cell {
  width: var(--sliderSize);
  height: var(--sliderSize);
  padding: 5px;
  border: none;
  background: none;
  margin: 0;
}

.bg-cell span {
  position: relative;
  width: 100%;
  height: 100%;
  background: #eee;
  font-size: 20px;
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #333;
  box-shadow: inset 0px 0px 3px rgb(0 0 0 / 10%);
}

.correct {
  filter: brightness(1.5) saturate(2);
}

.cell {
  width: var(--sliderSize);
  height: var(--sliderSize);
  padding: 5px;
  border: none;
  background: none;
  margin: 0;
  transition: transform 100ms ease-out;
  outline: 0;
}

.cell span {
  position: relative;
  width: 100%;
  height: 100%;
  background: white;
  cursor: pointer;
  font-size: 24px;
  border: 3px solid var(--colorC);
  border-radius: 5px;
  box-shadow: 2px 2px var(--colorC);
  color: var(--colorC);

  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "Contrail One", sans-serif;
  font-weight: bold;
  color: var(--colorC);
}

/* Game  */

.game {
  display: flex;
  align-items: center;
  flex-direction: row;
  margin-bottom: 50px;
  min-width: 1000px;
  justify-content: space-around;
}

.home-ad {
  margin-bottom: 50px;
}

.game:nth-child(even) {
  flex-direction: row-reverse;
}

.game:nth-child(even) .game-info {
  text-align: right;
}

.game:last-child {
  margin-bottom: 80px;
}

.game img {
  max-width: 350px;
  width: 100%;
}

.game-info {
  font-family: monospace;
  width: 350px;
  font-size: 20px;
  color: var(--colorB);
}

/* Home */

.home {
  font-family: "Contrail One", sans-serif;
  background-color: #f9f9f9;
  background-image: radial-gradient(#9a9ff4 0.55px, transparent 0.55px),
    radial-gradient(#9a9ff4 0.55px, #ffffff 0.55px);
  background-size: 22px 22px;
  background-position: 0 0, 11px 11px;
}

.home-head {
  margin: auto;
  width: 500px;
  background: white;
  text-align: center;
  padding: 40px;
  border: 2px solid var(--colorA);
  border-radius: 15px;
  box-shadow: 4px 4px var(--colorA);
  margin-top: 60px;
}

.home-head a {
  font-family: "Contrail One", sans-serif;
  color: var(--colorA);
  text-decoration: none;
  font-size: 85px;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 60px;
  padding-top: 6px;
}

.games {
  margin: auto;
  padding-top: 100px;
  display: flex;
  align-items: center;
  flex-direction: column;
}

.home-footer {
  color: var(--colorB);
  text-decoration: none;
  font-size: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 11px;
  font-family: monospace;
  background: white;
  margin: auto;
  width: 320px;
  padding: 20px;
  border-radius: 10px;
  border: 2px solid var(--colorB);
  box-shadow: 4px 4px var(--colorB);
  margin-top: 100px;
  font-weight: bold;
}

.home-footer a {
  color: inherit;
  text-decoration: none;
}

.sidebar-wrapper {
  padding: 8px;
  width: 100%;
  text-align: center;
  border: 2px solid var(--colorA);
  border-radius: 15px;
  gap: 8px;
  box-shadow: 2px 2px var(--colorA);
  background: white;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sidebar-header {
  font-size: 34px;
  color: var(--colorA);
  text-decoration: none;
}

.sidebar-settings {
  display: flex;
  text-transform: uppercase;
  justify-content: space-between;
  color: var(--colorB);
  padding-top: 10px;
  font-family: "Contrail One", sans-serif;
  display: none;
}

.sidebar-settings input {
  accent-color: currentColor;
  color: inherit;
  transform: scale(1.25);
  margin-right: 6px;
}

.sidebar-footer {
  padding: 10px;
  width: 100%;
  text-align: center;
  font-family: monospace;
  border: 2px solid var(--colorB);
  box-shadow: 2px 2px var(--colorB);
  border-radius: 7px;
  font-size: 14px;
  color: var(--colorB);
  background: white;
  display: flex;
  justify-content: space-evenly;
  font-weight: bold;
}

.sidebar-footer a {
  color: inherit;
  text-decoration: none;
}

.sidebar-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  background: white;
  border: 2px solid;
  border-radius: 10px;
  flex-grow: 1;
  border-color: var(--colorB);
  box-shadow: 2px 2px var(--colorB);
  color: var(--colorB);
  font-family: monospace;
}

.sidebar-info h1 {
  font-size: 25px;
  text-transform: uppercase;
}

.klotski-sidebar p {
  margin-top: 8px;
  margin-bottom: 8px;
}

.links .daily {
  color: var(--colorD);
  background: white;
  box-shadow: 2px 2px var(--colorD);
  display: flex;
  justify-content: center;
  gap: 7px;
  align-items: center;
}

.daily .check {
  display: none;
}

.daily.complete .check {
  display: block;
}

.streak-scores {
  font-family: "Contrail One", sans-serif;
  font-size: 22px;
  line-height: 30px;
}

.victory h4 {
  text-align: center;
  color: var(--colorA);
  margin-top: -10px;
  margin-bottom: 12px;
  font-size: 17px;
}

.victory h4 span {
  color: var(--colorD);
  font-size: 20px;
  padding: 5px;
}

.game-content {
  flex-grow: 1;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 50px;
  background-color: #ffffff;
  background-image: radial-gradient(#9a9ff4 0.55px, transparent 0.55px),
    radial-gradient(#9a9ff4 0.55px, #ffffff 0.55px);
  background-size: 22px 22px;
  background-position: 0 0, 11px 11px;
  position: relative;
  container-type: inline-size;
  container-name: sidebar;
}

.controls {
  display: flex;
  justify-content: space-between;
  padding: 20px;
  gap: 10px;
  background: #f9f9f9;
  font-size: 18px;
  border-radius: 15px;
  box-shadow: inset 0px 0px 4px 1px rgb(0 0 0 / 15%);
  font-family: "Contrail One", sans-serif;
  text-transform: uppercase;
}

.controls .buttons {
  display: flex;
  gap: 10px;
}

.controls button {
  padding: 10px 20px;
  border: 2px solid;
  border-radius: 6px;
  text-transform: uppercase;
  font-family: inherit;
  color: var(--colorA);
  background: white;
  box-shadow: 2px 2px;
  font-size: 18px;
  cursor: pointer;
}

.controls-settings {
  display: flex;
  gap: 10px;
}

.setting {
  padding: 10px;
  border: 2px solid var(--colorB);
  border-radius: 7px;
  color: var(--colorB);
  background: white;
  display: flex;
  justify-content: space-evenly;
  box-shadow: 2px 2px;
  min-width: 100px;
  justify-content: center;
  align-items: center;
}

.time {
  text-transform: none;
}

.legal article {
  max-width: 700px;
  margin: auto;
  font-family: monospace;
  padding: 50px;
  margin-top: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: auto;
}

/* Klotski  */

.klotski-wrapper {
  padding: 30px;
  background: white;
  position: relative;
  border-radius: 15px;
  box-shadow: inset 0px 0px 4px 1px rgb(0 0 0 / 15%);
}

.centerer {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

#grid {
  width: 400px;
  height: 500px;
  position: relative;
}

.klotski-wrapper .victory {
  top: 50%;
  margin-top: -150px;
  text-align: center;
}

.block {
  position: absolute;
  transition: transform 100ms ease-out;
  --blockPadding: 3px;
  cursor: grab;
}

.block span {
  pointer-events: none;
  content: "";
  display: block;
  width: calc(100% - var(--blockPadding) * 2);
  height: calc(100% - var(--blockPadding) * 2);
  border: 3px solid;
  position: absolute;
  border-radius: 3px;
  border-color: var(--colorC);
  top: var(--blockPadding);
  left: var(--blockPadding);
  box-shadow: 2px 2px var(--colorC);

  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "Contrail One";
  color: var(--colorC);
  font-size: 40px;
}

.links {
  display: flex;
  gap: 15px;
  margin-top: 25px;
}

.links a {
  padding: 10px 20px;
  border: 2px solid;
  border-radius: 6px;
  text-transform: uppercase;
  color: var(--colorA);
  background: white;
  box-shadow: 2px 2px;
  font-size: 18px;
  cursor: pointer;
  text-decoration: none;
  font-family: "Contrail One", sans-serif;
  display: block;
  flex: 1;
  text-align: center;
}

.text h2 {
  font-size: 42px;
  margin-bottom: 15px;
}

.text p {
  font-size: 15px;
}

.scores {
  text-align: left;
}

.dotted {
  position: relative;
}

.dotted:before {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 100%;
  height: 0;
  line-height: 0;
  border-bottom: 3px dotted;
  z-index: 1;
}

.dotted .left {
  background: inherit;
  display: inline;
  z-index: 2;
  padding-right: 10px;
  background: white;
  position: relative;
}

.sidebar-info .scores {
  font-size: 16px;
}

.dotted .right {
  background: inherit;
  position: absolute;
  background: white;
  bottom: 0;
  right: 0;
  padding-left: 10px;
  text-align: right;
  z-index: 2;
  font-weight: bold;
}

.victory {
  position: absolute;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.9);
  z-index: 2;
  border-radius: 7px;
  box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 1;
  scale: 1;
  transition: opacity 200ms ease-out, scale 200ms ease-out;
}

.victory.hidden {
  transition: none;
  opacity: 0;
  scale: 0.96;
  pointer-events: none;
  display: flex;
  z-index: -1;
}

.hidden {
  display: none;
}

.victory h3 {
  color: var(--colorA);
  font-size: 34px;
}

.victory p {
  color: var(--colorB);
  font-family: monospace;
  text-align: center;
  font-weight: bold;
  font-size: 18px;
  margin-top: 5px;
  margin-bottom: 20px;
}

.victory-buttons {
  display: flex;
  /* flex-direction: column; */
  gap: 10px;
}

.victory-buttons button,
.victory-buttons .button {
  padding: 5px 20px;
  border: 2px solid;
  border-radius: 6px;
  text-transform: uppercase;
  font-family: inherit;
  color: var(--colorA);
  background: white;
  box-shadow: 2px 2px;
  font-size: 18px;
  cursor: pointer;
  font-family: "Contrail One", sans-serif;
  text-align: center;
  flex-grow: 1;
  text-decoration: none;
}

.confetti-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  perspective: 800px;
  overflow: hidden;
  border-radius: 30px;
  transform: translateZ(0);
  pointer-events: none;
  z-index: 3;
}

.confetti {
  height: 1em;
  width: 1em;
  position: absolute;
  bottom: 105%;
  left: var(--posX);
  transform-style: preserve-3d;
  transform: rotate(var(--rotate, 0deg));
  animation: fall var(--speed, 5s) cubic-bezier(0.45, 0, 0.55, 1) infinite var(--delay, 0s);
  font-size: calc(var(--size, 1) * 0.5em);
}

.confetti:before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color);
  border-radius: inherit;
  animation: flip calc(var(--speed) / 5) linear infinite;
}

.rectangle {
  width: 0.5em;
  height: 1em;
}

#share-sluffle {
  position: relative;
}

.share-text {
  opacity: 1;
}

.shared-text {
  position: absolute;
  left: 0;
  width: 100%;
  text-align: center;
  pointer-events: none;
  opacity: 0;
}

.right-ad {
  max-width: 190px;
  min-width: 190px;
  height: 100vh;
  border-left: 3px solid #eee;
  background: #f9f9f9;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  overflow: hidden;
}

@keyframes fall {
  to {
    transform: translate3d(var(--posXDirection, 0), calc(100vh + 500%), 0)
      rotate(calc(var(--rotate, 0deg) * 2));
  }
}

@keyframes flip {
  to {
    transform: rotate(calc(var(--rotate, 0deg) * -0.5)) rotateY(-360deg);
  }
}

.mobile-ad {
  display: none;
}

@media screen and (max-width: 650px) {
  .game-body {
    flex-direction: column;
    min-height: 100dvh;
    gap: 0;
  }

  .sidebar {
    position: relative;
    top: 0;
    z-index: 2;
    height: fit-content;
    width: 100%;
    padding: 5px;
    padding-bottom: 0;
    background: none;
    border: 0;
    gap: 0;
  }

  .sidebar-wrapper {
    padding: 5px;
  }

  .sidebar-header {
    font-size: 20px;
  }

  .sidebar-top {
    gap: 10px;
  }

  .sidebar-info {
    padding: 10px 15px;
    margin-bottom: 2px;
  }

  .sidebar-info p {
    display: none;
  }

  .sidebar-info h1 {
    text-align: center;
  }

  .sidebar-info .scores {
    margin-top: 5px;
  }

  .sidebar-settings {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .controls {
    border-radius: 0;
    width: 100%;
    padding: 5px;
  }

  .controls .buttons {
    flex-grow: 1;
  }

  .controls button {
    padding: 5px 10px;
    flex-grow: 1;
  }

  .controls button,
  .setting {
    font-size: 14px;
    padding: 5px 10px;
  }

  .right-ad {
    display: none;
  }

  :root {
    --sliderSize: 65px;
  }

  .cell span {
    font-size: 20px;
  }

  .game-body .table,
  .game-body .bg-table {
    padding: 5px;
    margin: 30px 0 130px;
  }

  .tableWrapper {
    width: 100%;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    background: none;
    flex-grow: 1;
  }

  .game-content {
    min-width: 350px !important;
    height: auto;
    min-height: fit-content;
    flex-grow: 1;
    display: flex;
    flex-direction: column-reverse;
    gap: 0;
    justify-content: space-between;
  }

  .mobile-ad {
    display: block;
  }

  #share-sluffle {
    display: none;
  }

  .controls.above {
    flex-direction: row;
    background: none;
    box-shadow: none;
    justify-content: space-between;
  }

  .klotski-wrapper {
    padding: 10px;
  }
}

@media screen and (max-width: 750px) {
  .sidebar-info h1 {
    font-size: 20px;
  }

  .sidebar-footer {
    display: none !important;
  }

  .sidebar-top {
    gap: 7px;
  }

  .streak-scores {
    display: flex;
    font-size: 13px;
    width: 100%;
    gap: 20px;
  }

  .streak-item.dotted:before {
    display: none;
  }

  .streak-item {
    flex-grow: 1;
  }

  .daily-header {
    font-size: 20px !important;
  }

  .line {
    opacity: 0.2;
  }

  .home-head {
    width: fit-content;
    padding: 10px 20px;
    margin-top: 30px;
  }

  .home-head a {
    font-size: 40px;
  }

  .games {
    padding-top: 50px;
  }

  .game {
    flex-direction: column !important;
    --sliderSize: 60px !important;
    min-width: auto;
    padding: 0 20px;
    margin-bottom: 80px;
  }

  .game-info {
    max-width: 350px;
    width: 100%;
  }

  .puzzle-link {
    margin-bottom: 25px;
  }

  .home-footer {
    margin-top: 20px;
  }

  .text p {
    font-size: 18px;
  }

  .table,
  .bg-table {
    padding: 15px;
  }
}

.sidebar-footer {
  display: none;
}

@media screen and (min-height: 780px) {
  .sidebar-footer {
    display: flex;
  }
}

@media screen and (max-width: 600px) {
  :root {
    --sliderSize: 55px;
  }
}

@media screen and (max-width: 550px) {
  :root {
    --sliderSize: 50px;
  }
}

@container sidebar (max-width: 600px) {
  .controls {
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
}
