/* Global */
:root {
  --main-color: #303030;
  --secondary-color: #ffffff;
  --tertiary-color: #d4d4d4;
  --shadow: 0px 0px 2px rgba(0, 0, 0, 0.15), 0px 2px 5px rgba(0, 0, 0, 0.05),
    0px 8px 40px rgba(0, 0, 0, 0.04);
}

.dark-mode {
  --main-color: #ffffff;
  --secondary-color: rgb(25, 25, 25);
  --tertiary-color: #8f8f8f;
  --shadow: 0px 0px 2px rgba(255, 255, 255, 0.15),
    0px 2px 5px rgba(255, 255, 255, 0.05),
    0px 8px 40px rgba(255, 255, 255, 0.04);
}

* {
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  box-sizing: border-box;
}

*:focus {
  outline: none !important;
}

html,
body {
  background-color: var(--secondary-color);
  display: flex;
  justify-content: center;
  height: 100%;
  width: 100%;
}

body {
  color: var(--main-color);
  font-family: 'Nunito', sans-serif;
}

#error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
}

a,
a:focus,
a:active,
a:link {
  color: inherit;
  transition: opacity 0.3s ease-in-out;
  cursor: pointer;
}

a:hover {
  opacity: 0.6;
}

img {
  -webkit-user-drag: none;
}

#game-container {
  position: relative;
  display: flex;
  flex-direction: column;
  place-items: center;
  min-width: 290px;
  height: fit-content;
  border-radius: 14px;
  border-radius: 20px;
  padding: 0.2rem 1rem 0.4rem;
  margin: 0.75rem 0;
  box-shadow: var(--shadow);
}

/* Header */
.header {
  font-family: 'Nunito', sans-serif;
  font-size: 29px;
  font-weight: 1000;
  line-height: 38px;
}

#header {
  color: var(--main-color);
  margin-bottom: 0.1rem;
  white-space: nowrap;
  height: 38px;
}

#header span {
  position: relative;
  display: inline-block;
}

.wavy > span {
  animation: wavy 1s infinite;
  animation-delay: calc(0.1s * var(--i));
}

@keyframes wavy {
  0%,
  40%,
  100% {
    transform: translateY(0);
  }
  20% {
    transform: translateY(-6px);
  }
}

.japanese {
  font-family: 'Mochiy Pop One';
  font-size: 26px;
  height: 40px;
  font-weight: 500;
}

/* Board */
#board {
  height: 328px;
  min-width: 300px;
  display: flex;
  justify-content: center;
}

canvas {
  animation: appear 0.8s;
  pointer-events: none;
}

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

.flag-mode {
  cursor: crosshair;
}

/* Elements Container */
#container {
  padding: 0;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

button {
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  border-radius: 60px;
  white-space: nowrap;
  cursor: pointer;
  color: var(--secondary-color);
  background-color: var(--main-color);
  height: 2rem;
  width: fit-content;
  position: relative;
  animation: appear 0.8s;
  padding: 0.25rem 1rem;
  border: 3px solid var(--main-color);
  transition: box-shadow 0.3s ease-in-out;
}

button:hover {
  box-shadow: 2px 2px 0px 2px var(--tertiary-color);
}

/* Modals */
.modal {
  margin-top: 0.7rem;
  border-radius: 30px;
  opacity: 0;
  background-color: var(--secondary-color);
  transition: opacity 0.4s ease-in-out;
  position: absolute;
  z-index: -1;
  padding: 1rem 2rem 2rem 2rem;
  box-shadow: 0 0 12px var(--main-color);
}

/* Help Modal */
#help-modal {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  padding: 0.9rem 1rem 0.3rem 1rem;
  top: -337px;
}

#help-modal > * {
  margin: 0.35em 0;
  min-width: 29ch;
}

#help-modal > h3 {
  text-align: center;
  max-width: 15ch;
}

.help-emoji {
  width: 14px;
  margin-bottom: -2px;
}

#about {
  margin-top: 0.3em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
}

#about p {
  font-weight: 900;
  margin-bottom: -0.4em;
}

/* Custom Modal */
#custom-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-size: 0.8rem;
  padding: 1rem 1.2rem 1rem 1.2rem;
  top: -265px;
}

.custom-section {
  display: flex;
  align-items: center;
  margin-bottom: 0.2rem;
}

.custom-label {
  padding-bottom: 0.28rem;
  margin-right: 0.3rem;
  width: 30px;
}

.custom-input {
  width: 3.55rem;
  height: 2rem;
  text-align: center;
  margin-top: 0.1rem;
}

/* Stats Modal */
#stats-modal {
  top: -305px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.75rem;
}

#stats-not-available {
  width: 12ch;
  margin-top: 1rem;
  margin-bottom: 0;
}

#stats-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 0.25rem;
}

#stats-modal > button {
  grid-column: span 2;
  margin: 0.5rem 0 -0.85rem 0;
  border: 0;
}

.level {
  grid-column: 1 / 3;
  margin-bottom: 0.6rem;
  font-size: 0.9rem;
  font-weight: 900;
}

.label {
  font-weight: 900;
  text-align: end;
  margin-right: 0.5rem;
  white-space: nowrap;
}

.value {
  text-align: left;
  margin-left: 0.5rem;
}

/* End Modal */
#end-modal {
  top: -265px;
  font-size: 0.75rem;
  width: max-content;
  display: grid;
  padding-top: 1.5em;
  transition: opacity 0.75s ease-in-out;
  grid-template-columns: 1fr 1fr;
}

.help-link {
  text-decoration: none;
}

#end-button {
  grid-column: span 2;
  text-align: center;
  margin: 0.75rem auto -1rem;
  font-size: 0.75rem;
}

/* Emoji Buttons */
#emoji-buttons-container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  align-items: center;
  margin-top: -0.75rem;
}

.emoji-button {
  cursor: pointer;
  transition: opacity 0.3s ease-in-out;
  margin: 0.15rem 0.05rem;
  height: 42px;
}

.emoji-button > img {
  height: 42px;
}

.emoji-button:hover,
.emoji-button-clicked {
  opacity: 0.6;
}

.flag-clicked {
  opacity: 0.6;
  background-color: var(--tertiary-color);
  border-radius: 5px;
}

/* Forcer */
#forcer {
  margin: 1em 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#forcer-title {
  font-weight: 900;
  margin-bottom: 0.5em;
}

input {
  border: 2px dashed var(--tertiary-color);
  border-radius: 10px;
  padding: 0.5em 1em;
  width: 265px;
  margin-bottom: 0.5em;
  color: var(--main-color);
  background-color: var(--secondary-color);
}

::placeholder {
  color: var(--main-color);
  opacity: 0.4;
}

/* Easter Egg */
.easter-egg {
  pointer-events: none;
  position: fixed;
}

.easter-egg > img {
  width: 200px;
}

.easter-egg > * {
  /* Adjust animation duration to change the element’s speed */
  animation: fly 50s linear infinite;
  pointer-events: none !important;
  top: 0;
  left: 0;
  transform: translateX(-120%) translateY(-120%) rotateZ(0);
  position: fixed;
  animation-delay: 1s;
  z-index: 999999;
}

/* Keyframe values control where the element will begin
    and end its trajectory across the screen. Each rule
    represents a path the element follows across the screen. */
@keyframes fly {
  98.001%,
  0% {
    display: block;
    transform: translateX(-200%) translateY(100vh) rotateZ(0deg);
  }

  15% {
    transform: translateX(100vw) translateY(-100%) rotateZ(180deg);
  }

  15.001%,
  18% {
    transform: translateX(100vw) translateY(-30%) rotateZ(0deg);
  }

  40% {
    transform: translateX(-200%) translateY(3vh) rotateZ(-180deg);
  }

  40.001%,
  43% {
    transform: translateX(-200%) translateY(-100%) rotateZ(-180deg);
  }

  65% {
    transform: translateX(100vw) translateY(50vh) rotateZ(0deg);
  }

  65.001%,
  68% {
    transform: translateX(20vw) translateY(-200%) rotateZ(180deg);
  }

  95% {
    transform: translateX(10vw) translateY(100vh) rotateZ(0deg);
  }
}
