*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Menu */
#menu {
  width: 90%;
  max-width: 580px;
  margin: 20px auto;
  padding: 0 15px;
  display: flex;
  gap: 15px;
  justify-content: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-link {
  font-family: 'Arial Black', Arial, sans-serif;
  font-weight: 900;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #000;
  text-decoration: none;
  cursor: pointer;
}

.menu-link:hover {
  opacity: 0.5;
}

.menu-link-large {
  font-size: 20px;
}

.menu-link.active {
  text-decoration: underline;
}

/* FPS Dialog */
#fps-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.95);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
}

#fps-dialog.fps-dialog-hidden {
  display: none;
}

#fps-dialog-inner {
  border: 1px solid #000;
  padding: 30px;
  background: #fff;
  text-align: center;
}

#fps-dialog-title {
  font-family: 'Arial Black', Arial, sans-serif;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

#fps-input {
  font-family: 'Arial Black', Arial, sans-serif;
  font-weight: 900;
  font-size: 14px;
  text-align: center;
  border: 1px solid #000;
  padding: 8px 12px;
  width: 80px;
  outline: none;
  -moz-appearance: textfield;
}

#fps-input::-webkit-outer-spin-button,
#fps-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#fps-dialog-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

#fps-dialog-actions button {
  font-family: 'Arial Black', Arial, sans-serif;
  font-weight: 900;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #fff;
  border: 1px solid #000;
  padding: 8px 16px;
  cursor: pointer;
}

#fps-dialog-actions button:hover {
  background: #000;
  color: #fff;
}

header {
  width: 90%;
  max-width: 580px;
  margin: 0 auto;
  padding: 20px 15px 0;
}

main {
  width: 90%;
  max-width: 580px;
  margin: 0 auto;
  padding: 0 15px 20px;
}

#composition {
  border: 1px solid #000;
  padding: 15px;
}

#header-text {
  cursor: pointer;
}

#gallery {
  margin-top: 15px;
}

.tile {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #ffffff;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #ffffff;
}

.tile.error {
  aspect-ratio: 16/9;
  background: #ffffff;
  border: 1px solid #000000;
}

.tile.error img {
  visibility: hidden;
}

#sentinel {
  height: 1px;
  width: 100%;
  pointer-events: none;
}

#loader {
  text-align: center;
  padding: 20px;
  color: #888888;
  font-size: 14px;
  letter-spacing: 0.05em;
}

#loader.hidden {
  display: none;
}

#fortune {
  width: 100%;
  margin-top: 15px;
  cursor: pointer;
}

#composition-wrapper {
  position: relative;
}

.hint {
  position: absolute;
  right: calc(100% + 12px);
  font-family: 'Arial Black', Arial, sans-serif;
  font-weight: 900;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #000;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.hint.visible {
  opacity: 1;
  transform: translateX(0);
}

.hint.fade-out {
  opacity: 0 !important;
  transform: translateX(-8px) !important;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.hint-screenshot {
  top: 26px;
}

.hint-shuffle {
  top: 50%;
  transform: translate(-8px, -50%);
}

.hint-shuffle.visible {
  transform: translate(0, -50%);
}

.hint-shuffle.fade-out {
  transform: translate(-8px, -50%) !important;
}

.hint-gallery {
  bottom: 26px;
}

@media (max-width: 600px) {
  header, main {
    width: 95%;
    padding-left: 10px;
    padding-right: 10px;
  }

  #composition {
    padding: 10px;
  }

  .hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
