body {
  font-family: monospace;
  user-select: none;
  margin: 0;
}

html,
body {
  height: 100%;
  scrollbar-width: none;
}

/* Resoruces */

.ui {
  /* Set width to 100% - 20pt for padding */
  width: calc(100% - 24pt);
  display: block;
  letter-spacing: 2pt;
  padding: 4pt;
  font-size: 16pt;
}

.ui > div {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  padding-right: 4pt;
}

.moneyEarned {
  position: absolute;
  top: 20pt;
  left: 4pt;
  font-size: 12pt;
}

.event-log {
  position: absolute;
  left: 0;
  padding-top: 4pt;
  padding-left: 4pt;
  pointer-events: none; /* Allow clicks to pass through */ 
  z-index: 3;
  margin-right: auto;
}
.event-log-inner {
  overflow: hidden;
}
.event-log-line {
  width: fit-content;
  font-size: 10pt;
  list-style: 12pt;
  background: rgba(255, 255, 255, 0.77);
  border-radius: 6pt;
  padding: 2pt;
  margin: 2pt;
}
.money-earned-line {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 8pt;
  background: rgba(255, 255, 255, 0.77);
  border-radius: 8pt;
  padding: 1pt;
  margin: 1pt;
}


.fade-text {
  /* The magic */
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1), rgba(0,0,0,0));
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  
  mask-image: linear-gradient(to bottom, rgba(0,0,0,1), rgba(0,0,0,0));
  mask-repeat: no-repeat;
  mask-size: 100% 100%;
}

.wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.shop-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-layout {
  display: flex;
  flex-direction: column; /* stack by default (mobile-first) */
  gap: 1rem;
}

@media (min-width: 1100px) {
  .game-layout {
    flex-direction: row;
    justify-content: center;
    gap: 2rem;
    width: max-content;
    margin-inline: auto;
    align-items: flex-start;
  }
  
  /* Don't let either column grow; size to content */
  .wrapper,
  .shop-wrapper {
    flex: 0 0 auto;
  }

  .shop-wrapper {
    min-width: 268pt;
  }
}


/* Grid */

/* container that participates in layout */
.grid-scaler {
  position: relative;
  /* these two are what layout will see */
  height: auto;
  max-width: 100vw;
}

/* invisible spacer that reserves the scaled footprint */
.grid-scaler::before {
  content: "";
  display: block;
  width: var(--scaled-w, auto);
  height: var(--scaled-h, auto);
}

/* the actually visible, scaled stuff sits on top */
.grid-scaler-content {
  position: absolute;
  top: 0;
  left: 50%;
  transform-origin: top center;
  transform: translateX(-50%) scale(var(--s, 1));
}
.grid {
  display: flex;
  justify-content: center;
  flex-direction: column;
  width: 170pt;
  -webkit-tap-highlight-color: transparent;
  z-index: 0;
}

.grid:focus {
  outline: none; /* Removes any focus outline */
}
.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.row {
  display: flex;
  flex-direction: row;
}

.cell {
  font-size: 26pt;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  cursor: pointer;
}

.cell-container {
  width: 34pt;
  height: 34pt;
  overflow: hidden;
}

.symbol {
  transform-origin: top;
  cursor: pointer;
}

.symbol-counter {
  position: absolute;
  bottom: 0;
  right: 0;
  font-size: 11pt;
  font-family: sans-serif;
  color: white;
  font-weight: 900;
  -webkit-text-stroke-width: 0.5px;
  -webkit-text-stroke-color: black;
  pointer-events: none;
}

.symbol-pin {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 9pt;
  font-family: sans-serif;
}

.symbol-multiplier {
  position: absolute;
  bottom: 0;
  left: 0;
  font-size: 10pt;
  color: blue;
}

.interactive-emoji {
  cursor: pointer;
  display: inline-block;
  transition: transform 0.2s ease;
}
.interactive-emoji:hover {
  transform: scale(1.25);
}

/* Info */
.info {
  margin-top: 12pt;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: rgba(0, 0, 0, 0.3) 0px 2px 4px, rgba(0, 0, 0, 0.2) 0px 5px 8px -3px, rgba(0, 0, 0, 0.1) 0px -3px 0px inset;
  border-radius: 8pt;
  width: 256pt;
  height: 60pt;
  font-size: 11pt;
  line-height: 12pt;
  vertical-align: bottom;
  padding: 6pt;
  text-align: center;
  z-index: 10;
}

/* Shop */

.shop {
  margin-top: 12pt;
  margin-bottom: 18pt;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: rgba(0, 0, 0, 0.3) 0px 2px 4px, rgba(0, 0, 0, 0.2) 0px 5px 8px -3px, rgba(0, 0, 0, 0.1) 0px -3px 0px inset;
  border-radius: 8pt;
  width: 256pt;
  overflow: hidden;
  z-index: 10;
  padding: 6pt;
}

.shopItem {
  display: flex;
  align-items: center; /* Vertically centers the inner div */
  justify-content: center; /* Optional: centers the inner div horizontally */
  margin-bottom: 8pt;
}

.shopItem .shopEmoji {
  cursor: pointer;
}

.shopEmoji {
  width: 28pt;
  font-size: 22pt;
}

.description {
  padding-left: 4pt;
  font-size: 11pt;
  width: 180pt;
}

.cost {
  padding-left: 2pt;
  text-align: right;
  width: 36pt;
  font-size: 10pt;
}

.refreshDescription {
  text-align: right;
}

.buy {
  z-index: 1;
  margin-left: auto;
  padding-left: 4pt;
  font-size: 22pt;
}

/* Inventory */
.footer {
  position: fixed;
  /* center div inside */
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  left: 0pt;
  bottom: 0pt;
  flex-direction: column !important;
  padding-top: 4pt;
  padding-left: 4pt;
  padding-bottom: 4pt;
}

.inventory {
  width: 100%;
  font-size: 14pt;
  pointer-events: none;
  letter-spacing: 2pt;
  padding: 4pt;
}

.inventoryEntry {
  border-radius: 8pt;
  margin: 2pt;
  padding: 4pt;
  box-shadow: rgba(0, 0, 0, 0.3) 0px 2px 4px, rgba(0, 0, 0, 0.2) 0px 5px 8px -3px, rgba(0, 0, 0, 0.1) 0px -3px 0px inset;
  pointer-events: auto;
  display: inline-flex;
  align-items: baseline;
  cursor: pointer;
  padding-right: 2pt;
}

.inventoryEntryCount {
  font-size: 10pt;
  letter-spacing: 0pt;
  padding-right: 2pt;
}

/* Score */
.scoreContainer {
  pointer-events: none;
  cursor: pointer;

  position: fixed;
  top: 120pt;
  left: 0;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.score {
  padding: 4pt;
  font-size: 56pt;
  font-weight: 900;
}

.finalScore span {
  display: inline-block;
  animation: wave 1.5s ease-in-out infinite;
}

.trophy {
  padding: 4pt;
  padding-bottom: 120pt;
  font-size: 56pt;
  font-weight: 900;
}

.top-right {
  background: white;
  position: fixed;
  top: 0;
  right: 0;
  margin: 4pt;
}

#sidebar-menu {
  position: fixed;
  top: 0;
  right: -210pt; /* start off-screen */
  width: 200pt;
  height: 100vh;
  background-color: #fff;
  border-left: 1px solid black;
  transition: right 0.3s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

.sidebar-content {
  flex: 1 1 auto;
  min-height: 0;           /* important in flex containers so scrolling works */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.symbol-info-entry {
  padding-top: 1em;
}

#sidebar-menu.active {
  right: 0;
}

#close-sidebar {
  align-self: flex-end;
  background: none;
  border: none;
  font-size: 2em;
  cursor: pointer;
}

/* Menu items */
#sidebar-menu ul {
  list-style: none;
  padding-left: 1em;
}
#sidebar-menu li {
  padding-bottom: 0.5em;
}

#sidebar-menu a {
  text-decoration: none;
  font-size: 1.2em;
}

#sidebar-menu a:hover {
  text-decoration: underline;
}

.progression {
  position: absolute;
  top: 50px;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.level {
  padding: 5px 10px;
  margin: 5px 0;
  border-radius: 5px;
  cursor: pointer;
  background-color: #f0f0f0;
  transition:
    border 0.3s,
    background-color 0.3s;
  display: flex;
  justify-content: space-between;
  flex-direction: row;
  align-items: center;
}

.level.active {
  border: 2px solid #007bff;
}

.level.unbeaten {
  color: lightgrey;
  cursor: not-allowed;
}

.level.unbeaten:not(.active) {
  pointer-events: none;
}

.level.beaten {
  background-color: #d4edda;
}

.level.beaten:hover {
  background-color: #c3e6cb;
}

.level-reward {
  order: 1;
}

.level-name {
  order: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.level-highscore {
  order: 3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 600px) {
  .level-name {
    max-width: 25px;
    /* display: none; */
  }

  .level-highscore {
    max-width: 25px;
  }

  .wipe-button {
    white-space: normal;
    word-break: break-word;
    max-width: 75px;
  }
}

.wipe-button {
  text-align: center;
  padding: 2px 3px;
  font-size: 10pt;
  border-radius: 2px;
  background-color: #ff6347;
  color: white;
  border: none;
  cursor: pointer;
  transition:
    background-color 0.3s,
    transform 0.3s;
  margin-top: 20px;
}

.wipe-button:hover {
  background-color: #ff4500;
  transform: scale(1.05);
}

.wipe-button:active {
  background-color: #ff6347;
  transform: scale(0.95);
}

/* Settings */

.open-settings {
  position: fixed;
  top: 1;
  right: 0;
  margin: 4pt;
}

.settings-box {
  border: 1px solid #ccc;
  padding: 20pt;
  width: 256pt;
  overflow: hidden;
  position: fixed;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #f9f9f9;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.settings-box label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.settings-box input,
.settings-box textarea {
  width: 100%;
  margin-bottom: 15px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.settings-box button {
  padding: 10px 20px;
  margin-right: 10px;
  border: none;
  border-radius: 4px;
  background-color: #007bff;
  color: white;
  cursor: pointer;
}

.settings-box button:last-child {
  margin-right: 0;
}

.settings-box button:hover {
  background-color: #0056b3;
}

.settings-box .button-container {
  display: flex;
  justify-content: flex-end;
}

/* Animations */

@keyframes blurStart {
  0% {
    filter: blur(0px);
  }

  100% {
    filter: blur(6px);
  }
}

@keyframes scoreIn {
  0% {
    transform: translateY(-100vh);
  }

  80% {
    transform: translateY(0pt);
  }

  90% {
    transform: translateY(-8pt);
  }

  100% {
    transform: translateY(0pt);
  }
}

@keyframes scoreOut {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(-100vh);
  }
}

@keyframes startSpin {
  0% {
    transform: scaleY(1) translateY(0);
  }

  100% {
    transform: scaleY(0.5) translateY(90pt);
  }
}

@keyframes spin {
  0% {
    transform: scaleY(0.25) translateY(-70pt);
  }

  50% {
    transform: scaleY(1.4) translateY(0);
  }

  100% {
    transform: scaleY(0.5) translateY(90pt);
  }
}

@keyframes endSpin {
  0% {
    transform: scaleY(0.5) translateY(-90pt);
  }

  100% {
    transform: scaleY(1) translateY(0);
  }
}

@keyframes bounce {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4pt);
  }

  100% {
    transform: translateY(0);
  }
}

@keyframes flip {
  0% {
    transform: scaleX(1);
  }

  25% {
    transform: scaleX(0);
  }

  50% {
    transform: scaleX(-1);
  }

  75% {
    transform: scaleX(0);
  }

  100% {
    transform: scaleX(1);
  }
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(2pt);
  }

  50% {
    transform: translateX(0);
  }

  75% {
    transform: translateX(-2pt);
  }

  100% {
    transform: translateX(0);
  }
}

@keyframes grow {
  0% {
    transform: scale(1);
    transform-origin: bottom;
  }
  50% {
    transform: scale(var(--grow-scale, 1.2));
    transform-origin: bottom;
  }
  100% {
    transform: scale(1);
    transform-origin: bottom;
  }
}

@keyframes shakeRocket {
  0% {
    transform: translate(0, 0);
  }

  25% {
    transform: translate(2pt, -2pt);
  }

  50% {
    transform: translate(0, 0);
  }

  75% {
    transform: translate(-2pt, 2pt);
  }

  100% {
    transform: translate(0, 0);
  }
}

@keyframes rotate {
  0% {
    transform: rotate(0);
    transform-origin: center;
  }

  50% {
    transform: rotate(180deg);
    transform-origin: center;
  }

  100% {
    transform: rotate(360deg);
    transform-origin: center;
  }
}

@keyframes openShop {
  0% {
    transform: translateY(500pt);
    opacity: 0;
  }

  80% {
    transform: translateY(0);
    opacity: 1;
  }

  90% {
    transform: translateY(4pt);
  }

  100% {
    transform: translateY(0);
  }
}

@keyframes closeShop {
  0% {
    transform: translateY(0);
    opacity: 1;
  }

  100% {
    transform: translateY(500pt);
    opacity: 0;
  }
}

@keyframes fadeOutMoveDown {
  0% {
    opacity: 1;
    transform: translateY(0);
  }

  50% {
    opacity: 0.5;
    transform: translateY(16pt);
  }

  100% {
    opacity: 0;
    transform: translateY(16pt);
  }
}

@keyframes fadeOutHalf {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0.5;
  }
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes rowMoveIn {
  0% {
    transform: translateY(-32pt);
    opacity: 0;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes rowMoveOut {
  0% {
    transform: translateY(0);
    opacity: 1;
  }

  100% {
    transform: translateY(-32pt);
    opacity: 0;
  }
}

@keyframes wave {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(15pt);
  }
}

@keyframes eventLogScroll {
  0% {
    transform: translateY(-12pt);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes moneyEarnedRise {
  0% {
    transform: translateY(8pt);
    opacity: 1;
  }
  50% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(-8pt);
    opacity: 0;
  }
}

/* Misc */

button {
  font-size: 20pt;
  padding: 0;
  margin: 0;
  width: 32pt;
  height: 32pt;
  text-align: center;
  background: none;
  color: inherit;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  outline: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.blur {
  height: 100%;
  /* filter: blur(6px); */
}

.hidden {
  display: none;
}

.dev-hidden {
  display: none;
}
