html,
body {
  margin: 0;
  padding: 0;
  font-weight: 400;
  font-style: normal;
}

html {
  display: flex;
  justify-content: center;
  --ui-font: 'Special Elite', system-ui;
}
body {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgb(24, 0, 0);
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}
p,
section,
header,
footer,
button {
  font-family: var(--ui-font);
}
main {
  width: 100%;
  aspect-ratio: 16/9;
  position: absolute;
  max-height: 100vh;
}

h2 {
  margin-block: 0 0.5em;
}
button.play {
  background: rgba(255, 255, 255, 0.1) none;
  background-size: contain;
  margin: 0.4em 0;
  font-size: 3vw;
  color: white;
  white-space: nowrap;
  display: inline-block;
  padding: 1vh 0.75em 1vh 0.75em;
  border: 4px solid white;
  border-radius: 8px;
}

.buttons {
  display: flex;
  align-items: center;
  gap: 1em;
}
.invisible-btn {
  opacity: 0.01;
  overflow: hidden;
  cursor: pointer;
}

image-animation {
  overflow: hidden;
  position: relative;
  display: block;
}
image-animation > img {
  position: absolute;
  top: 0;
  left: 0;
  /* force-scale the image to fit its container */
  height: 100%;
  transform: translateX(0px);
}

.scene:not(.hidden) {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s ease-in; /* Customize the duration and timing function as needed */
}

.scene.hidden {
  opacity: 0;
  visibility: hidden;
  transition: visibility 0s linear 0.3s, opacity 0.3s linear; /* Delay the visibility change until after the opacity transition */
}
.scene.transitioning {
  opacity: 0.6;
}

.scrollable-contentbox {
  padding: 0.5em;
  font-size: 3vw;
  overflow-y: visible;
  flex: auto;
  font-size: 3vw;
  overflow-y: scroll;
  --sb-track-color: #a4a4a4;
  --sb-thumb-color: #5a5a5a;
  --sb-size: 19px;
}
/* Custom scrollbar */

.scrollable-contentbox::-webkit-scrollbar {
  width: var(--sb-size);
  border: 1px solid var(--sb-thumb-color);
}

.scrollable-contentbox::-webkit-scrollbar-track {
  background: var(--sb-track-color);
  border-radius: 1px;
}

.scrollable-contentbox::-webkit-scrollbar-thumb {
  background: var(--sb-thumb-color);
  border-radius: 1px;
}

@supports not selector(::-webkit-scrollbar) {
  .scrollable-contentbox {
    scrollbar-color: var(--sb-thumb-color) var(--sb-track-color);
  }
}

/*
 * Splash/EULA scene
 */
#splash {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  background: linear-gradient(#db207a, #9547af);
}
#splash-screen {
  aspect-ratio: 1 / 1;
  height: 80%;
  border-radius: 5px;
  background: rgb(184, 184, 184);
  display: flex;
  flex-direction: column;
}
#splash-screen * {
  color: black;
}

#eula-container {
  margin: 0.5em;
  border: 2px solid #4d4d4d;
}

#eula-container h2 {
  font-size: 1.2em;
}
#eula-container h3#credits {
  font-size: 0.9em;
  margin-top: 15em;
}
#eula-container p#credits {
  font-size: 0.7em;
  margin-left: 0.3em;
}
#eula-container p#credits a {
  font-weight: bolder;
  text-decoration: none;
  color: rgb(23, 0, 73);
  margin-right: 0.3em;
}

#eula-container .role {
  color: rgb(73, 73, 73);
}

#splash header {
  margin-top: 5%;
  padding-top: 5%;
  background-image: url('images/window_controls.png');
  background-repeat: no-repeat;
  background-position: top 0px right 14px;
  background-size: contain;
  padding-inline: 14px;
  position: relative;
  /* display: flex; */
  /* justify-content: flex-end; */
  gap: 0;
  /* border-bottom: 1px solid rgb(0, 0, 0); */
}

#splash-maximize {
  width: 4%;
  right: 4%;
  top: 10%;
  aspect-ratio: 1/1;
  position: absolute;
}
#splash-close {
  position: absolute;
  width: 4%;
  right: 15.3%;
  top: 10%;
  aspect-ratio: 1/1;
}
#splash footer.buttons {
  padding: 2px 24px;
  border-top: 2px solid rgb(73, 73, 73);
  /* height: 16%; */
  box-sizing: border-box;
  display: flex;
  /* padding-inline: 24px; */
  justify-content: space-evenly;
  align-self: flex-end;
  width: 100%;
  aspect-ratio: 10/1;
}
#splash button {
  border: 3px solid black;
  font-size: 3vw;
  padding: 1.4vw;
  border-radius: 0;
}
#splash button:hover,
#splash .icon-button {
  opacity: 0.7;
}

#splash .icon-button {
  appearance: none;
  margin: 0;
  aspect-ratio: 1/1;
  display: inline-block;
  background-size: contain;
}

#audioToggle {
  height: 65%;
  min-height: 32px;
  background: url('./images/audio-muted.svg') no-repeat;
  filter: invert(1);
}
#audioToggle:checked {
  background: url('./images/audio.svg') no-repeat;
}

#achievements-button {
  height: 50%;
  min-height: 25px;
  background: url('./images/trophy.png') no-repeat;
}

/*
 * Game over scene
 */
#gameover {
  display: flex;
  width: 90%;
  justify-content: center;
}

#gameover-screen {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: unset;
  height: 38%;
}

#gameover-screen > .prompt-outer {
  border-radius: 14px;
  position: unset;
  height: auto;
  background: linear-gradient(#db207a, #9547af);
}

#conclusion-container {
  padding: 1em;
  font-size: 3vw;
  overflow-y: visible;
  flex: auto;
  font-size: 0.7em;
  color: white;
}

#gameover footer.buttons {
  align-self: flex-end;
  /* height: 16%; */
  box-sizing: border-box;
  display: flex;
  padding-inline: 24px;
}
#gameover button.play {
  background: linear-gradient(#db207a, #9547af);
}

.grid-layer-stack {
  display: grid;
  position: relative;
}
.grid-layer-stack > .layer {
  grid-column: 1 / -1; /* Spans from the first to the last column line */
  grid-row: 1 / -1; /* Spans from the first to the last row line */
  z-index: 0;
  min-height: 0;
}
.grid-layer-stack > .layer[hidden] {
  visibility: collapse;
}

.backdrop {
  width: 100%;
  background-size: 100% auto;
  background-position: center;
  background-repeat: no-repeat;
}

#pageBackdrop {
  will-change: opacity, background-image;
  transition: opacity 1.2s;
}
#pageBackdrop.transitioning {
  opacity: 0.3;
  transition: opacity 0.2s;
}

.prompt-outer {
  position: absolute;
  box-sizing: border-box;
  top: 6.5%;
  right: 2.2%;
  height: 45.5%;
  width: 52%;
  padding: 2%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3vw;

  background-image: linear-gradient(to bottom, #ef82d2, #603f88);
  border: solid 6px #cfbf62;
  border-radius: 10px;
}
.prompt-inner {
  color: white;
}

.layer-stack {
  position: relative;
}
.layer-stack > .layer {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;
  z-index: 0;
}
.layer-stack > .layer[hidden] {
  visibility: collapse;
}

/*
 * Main promps scene
 */
#mouth {
  position: absolute;
  top: 17%;
  left: 14%;
  height: 46%;
  aspect-ratio: 1.1/1;
}
#mouth:not(.animating) {
  visibility: hidden;
}

#selection.selection-outer {
  position: absolute;
  right: 0;
  bottom: 0;
  height: 30%;
  width: 58%;
}

#selectionBackdrop {
  top: 8%;
  bottom: 8%;
  background: url('./images/gold_rolo_complete.png') no-repeat;
  background-size: cover;
}

#wordPicker {
  box-sizing: border-box;
  font-size: 2em;
  min-height: 3rem;
  color: white;
  padding: 0 4px 3.5% 4px;
  white-space: nowrap;
  overflow: hidden;
  top: 15%;
}
#wordPicker.empty {
  visibility: hidden;
}
#wordPicker:focus-visible {
  outline: none;
}

#wordsLineReticule {
  position: absolute;
}

#wordsLineReticule > * {
  user-select: none;
  pointer-events: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 33.33%;
}
#wordsLineReticule > .cursor {
  pointer-events: auto;
  background-size: cover;
  aspect-ratio: 2/1;
  width: 61%;
  left: 26%;
  top: -3%;
  bottom: 0;
  position: absolute;
}
#wordsLineReticule > .left {
  left: 0;
}
#wordsLineReticule > .right {
  right: 0;
}

#wordsLine {
  position: relative;
  top: 0;
  right: 0;
  height: 100%;
}

#wordsLine > .word {
  display: inline-block;
  padding: 6.5% 5% 0 5%;
  font-size: 4vw;
  border: 0.7vw solid #573a7b;
  border-radius: 4px;
  margin-inline: 2px;
  height: 100%;
  box-sizing: border-box;
}
#wordsLine > .word[selected] {
  outline: 1px solid white;
  padding: 6px;
}

/*
 * Achievements scene
 */

#achievements {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  background: linear-gradient(#db207a, #9547af);
}
#achievements-screen {
  aspect-ratio: 1 / 1;
  height: 80%;
  border-radius: 5px;
  background: rgb(184, 184, 184);
  display: flex;
  flex-direction: column;
}
#achievements-screen * {
  color: black;
}
#achievements-screen header {
  padding-inline-start: 10%;
  padding-block: 0.75em 0.5em;
  border-bottom: 2px solid rgb(73, 73, 73);
}
#achievements-screen h2 {
  font-size: 1.2em;
  margin: 0;
}
#achievements-screen h3 {
  font-size: 0.7em;
  margin: 0;
  text-align: center;
}

#endings-container {
  padding-inline-start: 10%;
}
#endings-container #endings-list {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

li.ending-item {
  padding-inline: 12% 0;
  margin: 0.5em 0;
  background: url('./images/checkbox_unchecked.png') no-repeat left center;
  background-size: 1.2em;
}
li.ending-item.checked {
  background-image: url('./images/checkbox_checked.png');
}
